Last active
May 12, 2016 17:27
-
-
Save getnashty/b26d706f2816e1611411a1bf66cb4bea to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
import React, { | |
AppRegistry, | |
Component, | |
Dimensions, | |
StyleSheet, | |
Text, | |
TouchableHighlight, | |
View | |
} from 'react-native'; | |
import Camera from 'react-native-camera'; | |
class BadInstagramCloneApp extends Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Camera | |
ref={(cam) => { | |
this.camera = cam; | |
}} | |
style={styles.preview} | |
captureMode={Camera.constants.CaptureMode.video} | |
aspect={Camera.constants.Aspect.fill}> | |
<Text style={styles.capture} onPress={this.takePicture.bind(this)}>[CAPTURE]</Text> | |
</Camera> | |
</View> | |
); | |
} | |
takePicture() { | |
this.camera.capture() | |
.then((data) => console.log(data)) | |
.catch(err => console.error(err)); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1 | |
}, | |
preview: { | |
flex: 1, | |
justifyContent: 'flex-end', | |
alignItems: 'center', | |
height: (Dimensions.get('window').width/4)*3, | |
width: Dimensions.get('window').width | |
}, | |
capture: { | |
flex: 0, | |
backgroundColor: '#fff', | |
borderRadius: 5, | |
color: '#000', | |
padding: 10, | |
margin: 40 | |
} | |
}); | |
AppRegistry.registerComponent('BadInstagramCloneApp', () => BadInstagramCloneApp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment