-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRootScene.js
122 lines (116 loc) · 3.45 KB
/
RootScene.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* Created by 叶子 on 2017/8/20.
*/
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import { TabNavigator, StackNavigator, TabBarBottom } from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
import DiscoverMusic from './discovermusic';
import MyMusic from './mymusic';
import Account from './account';
import Friends from './friends';
import PlayerScene from './player/PlayerScene';
import { ModalRoute } from './widgets';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducer from './redux/reducer';
import Player from './player/Player';
import { DetailScene, MvDetail, UserDetail, DjDetail } from './detail';
const store = createStore(reducer);
console.log(store.getState());
const Tab = TabNavigator(
{
DiscoverMusic: {
screen: DiscoverMusic,
navigationOptions: ({navigation}) => ({
tabBarLabel: '发现音乐',
tabBarIcon: ({ focused, tintColor }) => (
<Icon name="ios-disc-outline" size={30} color={tintColor} />
)
})
},
MyMusic: {
screen: MyMusic,
navigationOptions: ({navigation}) => ({
tabBarLabel: '我的音乐',
tabBarIcon: ({ focused, tintColor }) => (
<Icon name="ios-musical-notes-outline" size={30} color={tintColor} />
)
})
},
Friends: {
screen: Friends,
navigationOptions: ({navigation}) => ({
tabBarLabel: '朋友',
tabBarIcon: ({ focused, tintColor }) => (
<Icon name="ios-contacts-outline" size={30} color={tintColor} />
)
})
},
Account: {
screen: Account,
navigationOptions: {
tabBarLabel: '账号',
tabBarIcon: ({ focused, tintColor }) => (
<Icon name="ios-person-outline" size={30} color={tintColor} />
)
}
}
},
{
tabBarComponent: TabBarBottom,
tabBarPosition: 'bottom',
swipeEnabled: true,
animationEnabled: true,
initialRouteName: 'DiscoverMusic',
lazy: true,
tabBarOptions: {
activeTintColor: '#ffffff',
inactiveTintColor: '#cccccc',
style: {
backgroundColor: '#333333'
}
}
}
);
const Navigator = StackNavigator(
{
Tab: { screen: Tab},
Detail: { screen: DetailScene},
Player: { screen: PlayerScene},
MvDetail: {screen: MvDetail},
UserDetail: {screen: UserDetail},
DjDetail: {screen: DjDetail},
},
{
navigationOptions: {
headerBackTitle: '返回',
headerTintColor: '#333333',
showIcon: true
}
}
);
const ModalNavigator = StackNavigator(
{
MainNavigator: { screen: Navigator },
ModalMenu: { screen: ModalRoute},
},
{
mode: 'modal',
headerMode: 'none',
}
);
class RootScene extends PureComponent {
render() {
return (
<Provider store={store}>
<View style={{flex: 1}}>
{/*<Navigator />*/}
<ModalNavigator />
<Player />
</View>
</Provider>
)
}
}
export default RootScene;