-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
73 lines (55 loc) · 1.65 KB
/
App.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
import React, { Component } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import PageManage from './components/PageManage';
import PageManageNext from './components/PageManage_Next';
import Welcome from './components/Welcome';
import SplashScreen from 'react-native-splash-screen';
import AsyncStorage from '@react-native-community/async-storage'
export default class App extends Component {
navigationOptions = {
}
constructor(props) {
super(props);
this.state = {
isFirstLaunch:null
};
}
componentDidMount(){
setTimeout(()=>{
SplashScreen.hide();
},3000)
AsyncStorage.getItem('alreadyLaunched').then(value=>{
if(value==null){
// AsyncStorage.setItem('alreadyLaunched','true');
this.setState({isFirstLaunch:true});
}else{
this.setState({isFirstLaunch:false});
}
});
}
render() {
const Stack = createStackNavigator();
if(this.state.isFirstLaunch==null){
return null;
}
else if(this.state.isFirstLaunch==true){
return (
<NavigationContainer >
<Stack.Navigator initialRouteName="Welcome">
<Stack.Screen name="Welcome" component={Welcome} options={{headerShown: false,headerLeft:null}} />
<Stack.Screen
name="App" component={PageManage} options={{headerLeft:null,headerShown: false}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}else{
return (
<NavigationContainer>
<PageManageNext/>
</NavigationContainer>
)
}
}
}