@@ -12,9 +12,10 @@ import {
1212} from 'react-navigation' ;
1313import { headerOptions , RouteConfigs , } from './commons/components/navConfig' ;
1414
15- import { HomeTab , MineTab , DetailsView , CenterView , LoginView , OnePageView , TwoPageView , VideoPage , PlaceHolderPage , FontAdapterPage , DragListItemPage } from './root' ;
15+ // import { HomeTab, MineTab, DetailsView, CenterView, LoginView, OnePageView, TwoPageView, VideoPage, PlaceHolderPage, FontAdapterPage, DragListItemPage } from './root';
1616import { AppColors , AppStyles } from './commons/styles/index' ;
1717import CustomTabComponent from './commons/components/Tab' ;
18+ import { PageName } from './root' ;
1819const TabBarText = {
1920 home : '首页' ,
2021 centertext : '新增' ,
@@ -23,9 +24,9 @@ const TabBarText = {
2324
2425const TabNavigator = createBottomTabNavigator (
2526 {
26- Home : {
27+ HomeTab : {
2728
28- screen : HomeTab ,
29+ screen : PageName . HomeTab ,
2930 navigationOptions : props => {
3031 return RouteConfigs ( {
3132 imgSource : require ( '../src/assets/imgs/homeSelect.png' ) ,
@@ -36,8 +37,8 @@ const TabNavigator = createBottomTabNavigator(
3637
3738
3839 } ,
39- Center : {
40- screen : CenterView ,
40+ CenterView : {
41+ screen : PageName . CenterView ,
4142 navigationOptions : props => {
4243 return RouteConfigs ( {
4344 imgSource : require ( '../src/assets/imgs/homeSelect.png' ) ,
@@ -48,8 +49,8 @@ const TabNavigator = createBottomTabNavigator(
4849
4950
5051 } ,
51- Mine : {
52- screen : MineTab ,
52+ MineTab : {
53+ screen : PageName . MineTab ,
5354 navigationOptions : props => {
5455 return RouteConfigs ( {
5556 imgSource : require ( '../src/assets/imgs/homeSelect.png' ) ,
@@ -89,93 +90,75 @@ TabNavigator.navigationOptions = ({ navigation, screenProps }) => {
8990 }
9091}
9192
92- const stackNavigators = createStackNavigator (
93- {
94- Root : {
95- screen : TabNavigator ,
9693
97- } ,
98- DetailsView : {
99- screen : DetailsView ,
100- navigationOptions : props => {
101- return headerOptions ( {
102- ...props ,
103- ...{
104- back : true ,
105- } ,
106- } )
107- } ,
108- } ,
109- OnePageView : {
110- screen : OnePageView ,
111- navigationOptions : props => {
112- return headerOptions ( {
113- ...props ,
114- ...{
115- back : true ,
116- } ,
117- } )
118- } ,
119- } ,
120- TwoPageView : {
121- screen : TwoPageView ,
122- navigationOptions : props => {
123- return headerOptions ( {
124- ...props ,
125- ...{
126- back : true ,
127- } ,
128- } )
129- } ,
130- } ,
131- VideoPage : {
132- screen : VideoPage ,
133- navigationOptions : props => {
134- return headerOptions ( {
135- ...props ,
136- ...{
137- back : true ,
138- } ,
139- } )
140- } ,
141- } ,
142- PlaceHolderPage : {
143- screen : PlaceHolderPage ,
144- navigationOptions : props => {
145- return headerOptions ( {
146- ...props ,
147- ...{
148- back : true ,
149- } ,
150- } )
151- } ,
152- } ,
153- FontAdapterPage : {
154- screen : FontAdapterPage ,
155- navigationOptions : props => {
156- return headerOptions ( {
157- ...props ,
158- ...{
159- back : true ,
160- } ,
161- } )
162- } ,
163- } ,
164- DragListItemPage : {
165- screen : DragListItemPage ,
166- navigationOptions : props => {
167- return headerOptions ( {
168- ...props ,
169- ...{
170- back : true ,
171- } ,
172- } )
173- } ,
174- } ,
17594
95+ const stackPageNavigationOptions = ( props , boolBack ) => {
96+ return headerOptions ( {
97+ ...props ,
98+ ...{
99+ back : boolBack ,
100+ } ,
101+ } )
102+ }
176103
104+ const Pages = {
105+ Root : {
106+ screen : TabNavigator ,
107+ } ,
108+ DetailsView : {
109+ screen : PageName . DetailsView ,
110+ navigationOptions : stackPageNavigationOptions
111+ } ,
112+ OnePageView : {
113+ screen : PageName . OnePageView ,
114+ navigationOptions : stackPageNavigationOptions
115+ } ,
116+ TwoPageView : {
117+ screen : PageName . TwoPageView ,
118+ navigationOptions : stackPageNavigationOptions
119+ } ,
120+ VideoPage : {
121+ screen : PageName . VideoPage ,
122+ navigationOptions : stackPageNavigationOptions
123+ } ,
124+ PlaceHolderPage : {
125+ screen : PageName . PlaceHolderPage ,
126+ navigationOptions : stackPageNavigationOptions
177127 } ,
128+ FontAdapterPage : {
129+ screen : PageName . FontAdapterPage ,
130+ navigationOptions : stackPageNavigationOptions
131+ } ,
132+ DragListItemPage : {
133+ screen : PageName . DragListItemPage ,
134+ navigationOptions : stackPageNavigationOptions
135+ } ,
136+
137+ }
138+
139+ const stackNavigators = createStackNavigator ( Pages ,
140+
178141 {
142+
143+ // navigationOptions: ({ navigation } = 0) => {
144+ // return {
145+ // headerStyle: {
146+ // backgroundColor: AppColors.themecolor,
147+ // borderBottomWidth: 0,
148+ // },
149+ // headerTitleStyle: {
150+ // color: '#ffffff',
151+ // alignSelf: 'center',
152+ // justifyContent: 'center',
153+ // alignItems: 'center',
154+ // },
155+ // headerTintColor: '#ffffff',
156+ // headerBackTitle: null,
157+ // gesturesEnabled: false,
158+ // };
159+ // },
160+
161+
179162 // // defaultNavigationOptions: ({ navigation }) => {
180163
181164 // // return {
@@ -213,15 +196,24 @@ const stackNavigators = createStackNavigator(
213196 }
214197 } )
215198
199+ }
216200
217201
218- }
219202) ;
220203
204+ // stackNavigators.navigationOptions = (props) => {
205+ // return headerOptions({
206+ // ...props,
207+ // ...{
208+ // back: false,
209+
210+ // },
211+ // })
212+ // };
221213
222214const SwitchNavigator = createSwitchNavigator (
223215 {
224- Login : LoginView ,
216+ Login : PageName . LoginView ,
225217 App : stackNavigators ,
226218 } ,
227219 {
0 commit comments