import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
TouchableOpacity,
Image,
AlertIOS
} from 'react-native';
import {
CameraKitCamera,
CameraKitGallery
} from 'react-native-camera-kit';
import CameraScreen from './CameraScreen';
import AlbumsScreen from './AlbumsScreen';
class example extends Component {
constructor(props) {
super(props);
this.state = {
example: undefined
};
}
render() {
if (this.state.example) {
const Example = this.state.example;
return ;
}
return (
this.setState({example: CameraScreen})}>
Camera Screen
this.setState({example: AlbumsScreen})}>
Albums Screen
this.onCheckCameraAuthoPressed()}>
Check Camera Autotization Status
this.onCheckGalleryAuthoPressed()}>
Check Photos Autotization Status
);
}
async onCheckCameraAuthoPressed() {
const success = await CameraKitCamera.checkDeviceCameraAuthorizationStatus();
if (success) {
AlertIOS.alert('You have permission!')
}
else {
AlertIOS.alert('No permission :(')
}
}
async onCheckGalleryAuthoPressed() {
const success = await CameraKitGallery.checkDevicePhotosAuthorizationStatus();
if (success) {
AlertIOS.alert('You have permission!')
}
else {
AlertIOS.alert('No permission :(')
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
buttonText: {
color: 'blue',
marginBottom: 20,
fontSize: 20
}
});
AppRegistry.registerComponent('example', () => example);