File tree 3 files changed +63
-1
lines changed
3 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ import {
11
11
12
12
import React from 'react' ;
13
13
14
+ import CardStackStyleInterpolator from 'react-navigation/src/views/CardStackStyleInterpolator' ;
15
+
16
+
14
17
import {
15
18
Image ,
16
19
StyleSheet ,
@@ -34,6 +37,8 @@ const MainIcon = require('../resources/Main.png');
34
37
* 3、Test3是通过封装navigationOptions实现Tabbar和导航的
35
38
*/
36
39
40
+
41
+
37
42
const MyTab = TabNavigator ( {
38
43
Test1 : {
39
44
screen : Test1 ,
@@ -122,6 +127,8 @@ const MyTab = TabNavigator({
122
127
123
128
} ) ;
124
129
130
+
131
+
125
132
// 初始化StackNavigator
126
133
const MyNav = StackNavigator ( {
127
134
// 将TabNavigator包裹在StackNavigator里面可以保证跳转页面的时候隐藏tabbar
@@ -134,7 +141,10 @@ const MyNav = StackNavigator({
134
141
} ,
135
142
Detail2 :{
136
143
screen :Detail2 ,
137
- }
144
+ } ,
145
+
146
+ } , {
147
+
138
148
} ) ;
139
149
140
150
const TabOptions = ( tabBarTitle , normalImage , selectedImage , navTitle ) => {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Created by Rabbit on 2017/7/12.
3
+ */
4
+
5
+ import React , { Component } from 'react' ;
6
+ import {
7
+ AppRegistry ,
8
+ StyleSheet ,
9
+ Text ,
10
+ View
11
+ } from 'react-native' ;
12
+
13
+ export default class Detail3 extends Component {
14
+ render ( ) {
15
+ return (
16
+ < View style = { styles . container } >
17
+ < Text style = { styles . welcome } >
18
+ Welcome to React Native!
19
+ </ Text >
20
+ < Text style = { styles . instructions } >
21
+ To get started, edit index.android.js
22
+ </ Text >
23
+ < Text style = { styles . instructions } >
24
+ Double tap R on your keyboard to reload,{ '\n' }
25
+ Shake or press menu button for dev menu
26
+ </ Text >
27
+ </ View >
28
+ ) ;
29
+ }
30
+ }
31
+
32
+ const styles = StyleSheet . create ( {
33
+ container : {
34
+ flex : 1 ,
35
+ justifyContent : 'center' ,
36
+ alignItems : 'center' ,
37
+ backgroundColor : '#F5FCFF' ,
38
+ } ,
39
+ welcome : {
40
+ fontSize : 20 ,
41
+ textAlign : 'center' ,
42
+ margin : 10 ,
43
+ } ,
44
+ instructions : {
45
+ textAlign : 'center' ,
46
+ color : '#333333' ,
47
+ marginBottom : 5 ,
48
+ } ,
49
+ } ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ export default class Test2 extends Component {
23
23
headerTitle :navigation . state . params ?navigation . state . params . headerTitle :'Test2' ,
24
24
tabBarLabel :navigation . state . params ?navigation . state . params . tabBarLabel :'Test2' ,
25
25
tabBarIcon : ( ( { tintColor, focused} ) => {
26
+ if ( focused ) {
27
+ // 做操作
28
+ }
26
29
return (
27
30
< Image
28
31
// 可以用过判断focused来修改选中图片和默认图片
You can’t perform that action at this time.
0 commit comments