I am working on a simple react native portfolio-building app that uses react native camera. The takePicture function is defined as follows:
takePicture = async () => {
if (this.camera) {
let photo = await this.camera.takePictureAsync();
}
}
And it is called when a button is pressed:
onPress = { () => {
this.takePicture();
//console.log("loggin");
this.props.navigation.navigate('PictureScreen');
}
}
My issue is that I want to pass the photo to the PictureScreen. Photo is declared with let scope, so I am not able to access it and use it in my navigation call.
How do I access photo and pass it into the next screen? Should I use some sort of state mechanism?
thanks!