Guest User

Untitled

a guest
Oct 21st, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. /* @flow */
  2.  
  3. import React, { Component } from 'react';
  4. import {
  5. View,
  6. Text,
  7. StyleSheet,
  8. } from 'react-native';
  9.  
  10. import { Constants, Location, Permissions } from 'expo';
  11. import MainNavigator from '../navigation/MainNavigator';
  12. import AppInfo from '../components/AppInfo/AppInfo';
  13. import { MainStyle } from '../stylesheets/MainStyle';
  14.  
  15.  
  16. export default class GoHome extends Component {
  17. constructor(props){
  18. super(props);
  19. }
  20.  
  21. static navigationOptions = {
  22. header: null,
  23. };
  24.  
  25. componentWillMount(){
  26. this._getLocationAsync();
  27. }
  28.  
  29. _getLocationAsync = async () => {
  30. let { status } = await Permissions.askAsync(Permissions.LOCATION);
  31. if (status !== 'granted') {
  32. console.log('Error - location access denied');
  33. }else{
  34. let location = await Location.getCurrentPositionAsync({});
  35. console.log(location);
  36. }
  37. }
  38.  
  39. render() {
  40. return (
  41. <Image style = {MainStyle.imageContainer} source = {require('../assets/bg/bg_main.jpg')}>
  42. <AppInfo />
  43. <MainNavigator navigation = {this.props.navigation} />
  44. </Image>
  45. );
  46. }
  47. }
  48.  
  49. const styles = StyleSheet.create({
  50. });
  51.  
  52. GoHome.router = MainNavigator.router;
  53.  
  54. /* @flow */
  55.  
  56. import React, { Component } from 'react';
  57. import {
  58. View,
  59. Text,
  60. StyleSheet,
  61. Image
  62. } from 'react-native';
  63.  
  64. import { StackNavigator } from 'react-navigation';
  65. import Register from '../components/Register/Register';
  66. import Password from '../components/Password/Password';
  67. import AppInfo from '../components/AppInfo/AppInfo';
  68. import { MainStyle } from '../stylesheets/MainStyle';
  69. import GoHome from '../screens/GoHome';
  70.  
  71. const NavigatorMain = StackNavigator({
  72. Home: {
  73. screen: GoHome
  74. },
  75. Register: {
  76. screen: Register
  77. },
  78. Password: {
  79. screen: Password
  80. }
  81. });
  82.  
  83. // export default class MainNavigator extends Component {
  84. // render() {
  85. // return (
  86. // <NavigatorMain />
  87. // );
  88. // }
  89. // }
  90.  
  91. const styles = StyleSheet.create({
  92. });
  93.  
  94. export default NavigatorMain;
Add Comment
Please, Sign In to add comment