Update RNCamera.md

This commit is contained in:
Paras Sharma 2018-02-06 02:24:18 +05:30 committed by GitHub
parent 160e1e5277
commit cd3fcf5c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ import {
Dimensions, Dimensions,
StyleSheet, StyleSheet,
Text, Text,
TouchableHighlight, TouchableOpacity,
View View
} from 'react-native'; } from 'react-native';
import { RNCamera } from 'react-native-camera'; import { RNCamera } from 'react-native-camera';
@ -26,19 +26,20 @@ class BadInstagramCloneApp extends Component {
ref={ref => { ref={ref => {
this.camera = ref; this.camera = ref;
}} }}
style={{ style = {styles.preview}
flex: 1, type={RNCamera.Constants.Type.front}
}}
type={RNCamera.Constants.Type.back}
flashMode={RNCamera.Constants.FlashMode.on} flashMode={RNCamera.Constants.FlashMode.on}
permissionDialogTitle={'Permission to use camera'} permissionDialogTitle={'Permission to use camera'}
permissionDialogMessage={'We need your permission to use your camera phone'} permissionDialogMessage={'We need your permission to use your camera phone'}
/> />
<View style={{flex: 0, flexDirection: 'row', justifyContent: 'center',}}>
<TouchableOpacity <TouchableOpacity
onPress={this.takePicture.bind(this)} onPress={this.takePicture.bind(this)}
> style = {styles.capture}
<Text> SNAP </Text> >
</TouchableOpacity> <Text style={{fontSize: 14}}> SNAP </Text>
</TouchableOpacity>
</View>
</View> </View>
); );
} }
@ -56,7 +57,22 @@ class BadInstagramCloneApp extends Component {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'column',
backgroundColor: 'black'
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center'
},
capture: {
flex: 0,
backgroundColor: '#fff',
borderRadius: 5,
padding: 15,
paddingHorizontal: 20,
alignSelf: 'center',
margin: 20
} }
}); });
@ -345,4 +361,4 @@ Become a sponsor and get your logo on our README on Github with a link to your s
------------ ------------
Thanks to Brent Vatne (@brentvatne) for the `react-native-video` module which provided me with a great example of how to set up this module. Thanks to Brent Vatne (@brentvatne) for the `react-native-video` module which provided me with a great example of how to set up this module.