/
index.ios.js
86 lines (73 loc) · 1.72 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Animated,
ScrollView,
Router
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import { createRootNavigator } from "./App/Config/Router";
import { isSignedIn } from "./App/Config/auth";
import Search from './App/Screens/Search';
import Main from './App/Screens/Main';
import SignUp from './App/Screens/SignUp';
//import * as firebase from 'firebase';
//import Firebase from './App/Lib/firebase';
import Header from "./App/Screens/Helpers/Header";
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
navigator: {
flex:1,
},
titleStyle: {
marginBottom: 10
},
image: {
width: 50,
height: 50
},
header: {
paddingTop: 30,
alignItems: "center"
},
scrollView: {
flex: 1
}
});
export default class FirstRNProject extends Component {
constructor(props) {
super(props);
this.state = {
signedIn: false,
checkedSignIn: false
};
}
componentWillMount() {
isSignedIn()
.then(res => this.setState({ signedIn: res, checkedSignIn: true }))
.catch(err => alert("An error occurred"));
}
render() {
//This uses Auth.js
const { checkedSignIn, signedIn } = this.state;
//This uses Auth.js
// If we haven't checked AsyncStorage yet, don't render anything (better ways to do this)
if (!checkedSignIn) {
return null;
}
const Layout = createRootNavigator(signedIn);
return <Layout />;
}
}
AppRegistry.registerComponent('FirstRNProject', () => FirstRNProject);