-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RNCamera example app, Usage documentation
- Loading branch information
Showing
24 changed files
with
5,913 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ DerivedData/ | |
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
.idea | ||
|
||
## Other | ||
*.moved-aside | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["react-native"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import RNCamera from 'react-native-camera-ios'; | ||
|
||
export default RNCamera; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { | ||
View, | ||
Button, | ||
StyleSheet | ||
} from 'react-native'; | ||
import RNCamera from 'react-native-camera-ios'; | ||
|
||
const styles = StyleSheet.create({ | ||
overlayRight: { | ||
position: 'absolute', | ||
top: 0, bottom: 0, right: 0, | ||
width: 80, | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
} | ||
}); | ||
export default class CustomCamera extends React.Component { | ||
static propTypes = { | ||
...RNCamera.propTypes | ||
}; | ||
|
||
render() { | ||
return ( | ||
<RNCamera | ||
ref={(r) => this.camera = r} | ||
{...this.props} | ||
> | ||
<View | ||
style={styles.overlayRight} | ||
> | ||
<Button | ||
onPress={() => this.camera.capture()} | ||
title="Take" | ||
/> | ||
</View> | ||
</RNCamera> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'react-native'; | ||
import React from 'react'; | ||
import Index from '../index.ios.js'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
it('renders correctly', () => { | ||
const tree = renderer.create( | ||
<Index /> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "RNCameraExamples", | ||
"displayName": "RNCameraExamples" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* RNCamera Examples React Native App | ||
* https://github.com/houserater/react-native-camera-ios | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
AppRegistry, | ||
StyleSheet, | ||
Button, | ||
View | ||
} from 'react-native'; | ||
|
||
import BasicCamera from "./BasicCamera"; | ||
import CustomCamera from "./CustomCamera"; | ||
|
||
export default class RNCameraExamples extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
basicCameraVisible: false | ||
}; | ||
} | ||
_setCameraVisible(type, visible) { | ||
let field = `${type}CameraVisible`; | ||
this.setState({ | ||
[field]: visible | ||
}); | ||
} | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<Button | ||
onPress={() => this._setCameraVisible('basic', true)} | ||
title="Launch Basic Camera" | ||
/> | ||
|
||
<Button | ||
onPress={() => this._setCameraVisible('custom', true)} | ||
title="Launch Custom Camera" | ||
/> | ||
|
||
<BasicCamera | ||
visible={this.state.basicCameraVisible} | ||
onCancel={() => this._setCameraVisible('basic', false)} | ||
onCapture={() => this._setCameraVisible('basic', false)} | ||
/> | ||
|
||
<CustomCamera | ||
visible={this.state.customCameraVisible} | ||
onCapture={() => this._setCameraVisible('custom', false)} | ||
/> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: 'white', | ||
}, | ||
}); | ||
|
||
AppRegistry.registerComponent('RNCameraExamples', () => RNCameraExamples); |
Oops, something went wrong.