Created
June 15, 2018 02:03
-
-
Save dceddia/c0712125c953cdf82d90abef84ee897f to your computer and use it in GitHub Desktop.
Render the Camera, or the last photo.
This file contains hidden or 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
render() { | |
const { photo } = this.state; | |
return ( | |
<View style={{ flex: 1, width: '100%' }}> | |
{photo ? ( | |
<ImageBackground | |
style={{ flex: 1 }} | |
source={{ uri: photo.uri }} /> | |
) : ( | |
<Camera | |
style={{ flex: 1 }} | |
onPress={this.takePicture} | |
type={Camera.Constants.Type.back} | |
ref={cam => this.camera = cam}> | |
<TouchableOpacity | |
style={{ flex: 1 }} | |
onPress={this.takePicture}/> | |
</Camera> | |
)} | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment