forked from itzikbenh/React-Native-on-Rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
61 lines (55 loc) · 1.3 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Navigator,
Text,
View
} from 'react-native';
import Login from './login';
import Register from './register';
import Root from './root';
import Home from './home';
import Update from './update';
class ReactNativeRailsAuth extends Component {
renderScene(route, navigator) {
console.log(route);
if(route.name == 'root') {
return <Root navigator={navigator} />
}
if(route.name == 'register') {
return <Register navigator={navigator} />
}
if(route.name == 'login') {
return <Login navigator={navigator} />
}
if(route.name == 'home') {
return <Home navigator={navigator} {...route.passProps} />
}
if(route.name == 'update') {
return <Update navigator={navigator} {...route.passProps} />
}
}
render() {
return (
<View style={styles.container}>
<Navigator
initialRoute={{name: 'root'}}
renderScene={this.renderScene.bind(this)}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
});
AppRegistry.registerComponent('ReactNativeRailsAuth', () => ReactNativeRailsAuth);