-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
50 lines (41 loc) · 1.06 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
import React, { Component } from 'react'
import { Text } from 'react-native'
import { addNavigationHelpers, StackNavigator } from 'react-navigation'
import Intro from './app/Intro/Intro'
import SlideShow from './app/SlideShow'
import SlideIndex from './app/SlideIndex'
export const screens = {
Intro: { screen: Intro },
Index: { screen: SlideIndex, },
SlideShow: { screen: SlideShow },
}
const navigationConfig = {
headerMode: 'screen',
navigationOptions: {
header: {
visible: false,
},
},
}
const AppNavigator = StackNavigator(screens, navigationConfig)
const navReducer = (action, state) => {
switch (action.type) {
case 'forwards': return state
default:
return AppNavigator.router.getStateForAction(action, state) || state
}
}
export default class extends Component {
state = undefined
dispatch = (action) =>
this.setState(navReducer(action, this.state))
render() {
const navigation = addNavigationHelpers({
dispatch: this.dispatch,
state: this.state,
})
return (
<AppNavigator />
)
}
}