How to link RCTCameraRoll for Android

I am trying to use a library CameraRoll, but the documentation does not indicate how to link it for Android. Instead, it contains steps for iOS . It says that Android is supported, but I have no idea how to link it to use it.

+4
source share
1 answer

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 = {};
    //options.location = ...
    this.camera.capture({metadata: options})
      .then((data) => console.log(data))
      .catch(err => console.error(err));
  }
}

https://github.com/chrisbianca/react-native-cameraroll#install

-1

Source: https://habr.com/ru/post/1673172/


All Articles