-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
57 lines (48 loc) · 1.41 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
import React from 'react';
import _ from 'lodash';
import BaobabPropTypes from 'baobab-prop-types';
import createReactClass from 'create-react-class';
import {
AppRegistry,
} from 'react-native';
import schema from 'libs/state';
import tree from 'libs/tree';
import { LoginScreen } from 'screens/login';
import Main from 'screens/main';
const App = schema({})(createReactClass({
propTypes: {
tree: BaobabPropTypes.cursor.isRequired,
},
render() {
const tokenCursor = this.props.tree.token;
const loginScreen = this.props.tree.loginScreen;
const mainScreen = this.props.tree.mainScreen;
const keyPairStatusCursor = this.props.tree.keyPairStatus;
if (_.isEmpty(_.keys(this.props.tree.get()))) {
return null;
}
if (tokenCursor.get('status') !== 'Succeed') {
return (
<LoginScreen
tree={loginScreen}
tokenCursor={tokenCursor}
keyPairStatusCursor={keyPairStatusCursor}
/>
);
}
return (
<Main
tree={mainScreen}
tokenCursor={tokenCursor}
keyPairStatusCursor={keyPairStatusCursor}
/>
);
},
}));
function skin() {
return (
<App tree={tree} />
);
}
AppRegistry.registerComponent('skin', () => skin);
export default skin;