I came to the same question. The fact is that
We must create the project using the React Init method, then automatically create the Android and IOS folder.
Later you can automatically install and link your own libraries. Here are the code snippets.
-native init Cameraroll
npm response-native-camera --save
-
export default class App extends Component<{}> {
render() {
return (
<View style={styles.container}>
<Camera
ref={(cam) => {
this.camera = cam;
}}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}>
<Text style={styles.capture} onPress={this.takePicture.bind(this)}>[CAPTURE]</Text>
</Camera>
</View>
);
}
takePicture() {
const options = {};
this.camera.capture({metadata: options})
.then((data) => console.log(data))
.catch(err => console.error(err));
}
}
https://github.com/chrisbianca/react-native-cameraroll#install