Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Added more scenes and Splash auto navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Abe committed Feb 16, 2020
1 parent 71d4194 commit e2ea784
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
12 changes: 11 additions & 1 deletion src/navigation/index.jsx
Expand Up @@ -2,13 +2,23 @@ import React from 'react'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import SceneSplash from '../scenes/auth/sceneSplash'
import SceneAppLoading from '../scenes/auth/sceneAppLoading'
import SceneLogin from '../scenes/auth/sceneLogin'
import SceneHome from '../scenes/auth/sceneHome'
import SceneSettings from '../scenes/auth/sceneSettings'
import SceneGameHome from '../scenes/game/sceneGameHome'

const Stack = createStackNavigator()

const Navigation = () => (
<NavigationContainer>
<Stack.Navigator>
<Stack.Navigator initialRouteName="Splash">
<Stack.Screen name="Splash" component={SceneSplash} options={{ headerShown: false }} />
<Stack.Screen name="AppLoading" component={SceneAppLoading} options={{ headerShown: false }} />
<Stack.Screen name="Login" component={SceneLogin} options={{ headerShown: false }} />
<Stack.Screen name="Home" component={SceneHome} options={{ headerShown: false }} />
<Stack.Screen name="Settings" component={SceneSettings} options={{ headerShown: false }} />
<Stack.Screen name="GameHome" component={SceneGameHome} options={{ headerShown: false }} />
</Stack.Navigator>
</NavigationContainer>
)
Expand Down
28 changes: 20 additions & 8 deletions src/scenes/auth/sceneSplash.jsx
@@ -1,13 +1,25 @@
import React from 'react'
import React, { useEffect } from 'react'
import { Text } from 'react-native'
import PropTypes from 'prop-types'
import DefaultPage from '../../components/DefaultPage'

const SceneSplash = () => (
<DefaultPage>
<Text>
Splash
</Text>
</DefaultPage>
)
const SceneSplash = ({ navigation }) => {
useEffect(() => {
setTimeout(() => {
navigation.navigate('AppLoading')
}, 2000)
}, [])
return (
<DefaultPage>
<Text>
Splash
</Text>
</DefaultPage>
)
}

SceneSplash.propTypes = {
navigation: PropTypes.object.isRequired,
}

export default SceneSplash

0 comments on commit e2ea784

Please sign in to comment.