95 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-05-31 14:46:49 +03:00
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
2016-06-02 14:08:06 +03:00
TouchableOpacity,
Image,
2016-06-07 18:42:59 +03:00
AlertIOS
2016-05-31 14:46:49 +03:00
} from 'react-native';
2016-06-02 14:08:06 +03:00
import _ from 'lodash';
import Immutable from 'seamless-immutable';
2016-06-14 18:12:50 +03:00
2016-06-02 14:08:06 +03:00
import {
CameraKitCamera,
} from 'react-native-camera-kit';
2016-06-14 18:12:50 +03:00
import CameraScreen from './CameraScreen';
import AlbumsScreen from './AlbumsScreen';
2016-05-31 14:46:49 +03:00
class example extends Component {
constructor(props) {
super(props);
this.state = {
2016-06-14 18:12:50 +03:00
example: undefined
};
2016-05-31 14:46:49 +03:00
}
render() {
2016-06-14 18:12:50 +03:00
if (this.state.example) {
const Example = this.state.example;
return <Example />;
2016-06-07 18:42:59 +03:00
}
2016-05-31 14:46:49 +03:00
return (
2016-06-14 18:12:50 +03:00
<View style={styles.container}>
2016-06-07 18:42:59 +03:00
2016-06-14 18:12:50 +03:00
<TouchableOpacity onPress={() => this.setState({example: CameraScreen})}>
<Text style={styles.buttonText}>
Camera Screen
</Text>
</TouchableOpacity>
2016-06-07 18:42:59 +03:00
2016-06-14 18:12:50 +03:00
<TouchableOpacity onPress={() => this.setState({example: AlbumsScreen})}>
<Text style={styles.buttonText}>
Albums Screen
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={this.onCheckAuthoPressed.bind(this)}>
<Text style={styles.buttonText}>
Check Autotization Status
</Text>
</TouchableOpacity>
2016-06-02 14:08:06 +03:00
2016-06-14 18:12:50 +03:00
</View>
2016-05-31 14:46:49 +03:00
2016-06-14 18:12:50 +03:00
);
2016-06-02 14:08:06 +03:00
}
2016-06-07 18:42:59 +03:00
async onCheckAuthoPressed() {
const success = await CameraKitCamera.checkDeviceAuthorizarionStatus();
if (success){
AlertIOS.alert('You rock!')
}
else {
AlertIOS.alert('You fucked!')
}
}
2016-05-31 14:46:49 +03:00
}
2016-06-14 18:12:50 +03:00
2016-05-31 14:46:49 +03:00
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
2016-06-14 18:12:50 +03:00
alignItems: 'center',
backgroundColor: '#F5FCFF',
2016-05-31 14:46:49 +03:00
},
2016-06-14 18:12:50 +03:00
buttonText: {
color: 'blue',
marginBottom: 20,
fontSize: 20
2016-05-31 14:46:49 +03:00
2016-06-07 18:42:59 +03:00
}
2016-05-31 14:46:49 +03:00
});
2016-06-14 18:12:50 +03:00
2016-05-31 14:46:49 +03:00
AppRegistry.registerComponent('example', () => example);