0

I am trying to take a photo using react native camera immediately after changing from back to front camera. To give you an idea, the code looks kind of like this:

state = {
    type: Camera.Constants.Type.back
}

takePicture = () => {
    const options = {quality:0.5}
    this.setState({type:Camera.Constants.Type.front}, () => {
        this.camera.takePictureAsync(options).then(data => {
            console.log(data)
        });
    })
};

I presumed that the photo I would have taken would be the one with the front facing camera. However, the photo i get is always the one with the back facing camera. Is there something im missing?

Luke Tan
  • 2,048
  • 2
  • 13
  • 21

1 Answers1

0

In your render method, are you including the type as an attribute?

<Camera ... type={this.state.type} />
markmoxx
  • 1,492
  • 1
  • 11
  • 21