forked from osdio/noder-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.js
More file actions
57 lines (47 loc) · 996 Bytes
/
Utils.js
File metadata and controls
57 lines (47 loc) · 996 Bytes
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
import React, {
Component,
View,
StyleSheet,
Text,
StatusBar
} from 'react-native';
import Toast from '../components/base/Toast';
import secretKey from '../testKey';
class Utils extends Component {
componentDidMount() {
const {actions} = this.props;
actions.getReducerFromAsyncStorage();
// if (__DEV__) {
// actions.checkToken(secretKey, ()=> {
// actions.toast('登陆成功');
// });
// }
}
componentWillReceiveProps(nextProps) {
if (this.props.toast.id !== nextProps.toast.id) {
this.toast.show(nextProps.toast.text, nextProps.toast.timeout);
}
}
render() {
return (
<View style={styles.container}>
<StatusBar barStyle="light-content"/>
<Toast ref={ (view)=> this.toast=view }/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
position: 'absolute',
top: 0,
left: 0
}
});
export const LayoutComponent = Utils;
export function mapStateToProps(state) {
const {utils = {}} = state;
return {
...utils
}
}