@@ -9,90 +9,104 @@ import Post from '../screens/Post';
9
9
import Notification from '../screens/Notification' ;
10
10
import Profile from '../screens/Profile' ;
11
11
import { AddButton } from '../components/AddButton' ;
12
+ import { ImageBackground } from 'react-native' ;
12
13
13
14
const Tab = createBottomTabNavigator ( ) ;
14
15
15
16
export default function TabNavigator ( props ) {
16
17
return (
17
- < Tab . Navigator
18
- initialRouteName = "Home"
19
- options = { {
20
- // title: 'routeName',
21
- tabBarOnPress : ( { navigation, defaultHandler} ) => {
22
- console . log ( 'New Tab Screen tabBarOnPress working' ) ;
23
- defaultHandler ( ) ;
24
- } ,
25
- } }
26
- tabBarOnPress = { ( { previousScene, scene, jumpToIndex} ) => {
27
- const { route, index, focused} = scene ;
28
-
29
- if ( focused ) {
30
- navigation . state . params . scrollToTop ( ) ;
31
- }
32
- jumpToIndex ( 0 ) ;
33
- } }
34
- tabBarOptions = { {
35
- activeTintColor : '#161F3D' ,
36
- showLabel : false ,
37
- } } >
38
- < Tab . Screen
39
- name = "Home"
40
- options = { {
41
- tabBarIcon : ( { color, size} ) => (
42
- < FontAwesome5 name = { 'home' } color = { color } size = { size } />
43
- ) ,
44
- } }
45
- children = { ( ) => < Home { ...props } /> }
46
- />
47
- < Tab . Screen
48
- name = "Message"
49
- options = { {
50
- tabBarIcon : ( { color, size} ) => (
51
- < FontAwesome5 name = { 'comments' } color = { color } size = { size } />
52
- ) ,
53
- } }
54
- children = { ( ) => < Message { ...props } /> }
55
- />
56
- < Tab . Screen
57
- name = "Post"
18
+ < ImageBackground
19
+ style = { { flex : 1 } }
20
+ source = { require ( '../assets/background.png' ) } >
21
+ < Tab . Navigator
22
+ initialRouteName = "Home"
58
23
options = { {
59
- tabBarIcon : ( { color, size} ) => (
60
- < AddButton />
61
- // <FontAwesome5
62
- // name={'plus-circle'}
63
- // // color={'#E9446A'}
64
- // size={44}
65
- // style={{
66
- // color: '#E9446A',
67
- // shadowColor: '#E9446A',
68
- // shadowOffset: {width: 0, height: 0},
69
- // shadowRadius: 10,
70
- // shadowOpacity: 0.3,
71
- // }}
72
- // />
73
- ) ,
24
+ // title: 'routeName',
25
+ tabBarOnPress : ( { navigation, defaultHandler} ) => {
26
+ console . log ( 'New Tab Screen tabBarOnPress working' ) ;
27
+ defaultHandler ( ) ;
28
+ } ,
74
29
} }
75
- // children={() => <Post {...props} />}
76
- />
77
- < Tab . Screen
78
- name = "Notification"
79
- options = { {
80
- tabBarIcon : ( { color, size} ) => (
81
- < FontAwesome5 name = { 'bell' } color = { color } size = { size } />
82
- ) ,
83
- } }
84
- children = { ( ) => < Notification { ...props } /> }
85
- />
86
- < Tab . Screen
87
- name = "Profile"
88
- component = { Profile }
89
- options = { {
90
- tabBarIcon : ( { color, size} ) => (
91
- < FontAwesome5 name = { 'user' } color = { color } size = { size } />
92
- ) ,
30
+ tabBarOnPress = { ( { previousScene, scene, jumpToIndex} ) => {
31
+ const { route, index, focused} = scene ;
32
+
33
+ if ( focused ) {
34
+ navigation . state . params . scrollToTop ( ) ;
35
+ }
36
+ jumpToIndex ( 0 ) ;
93
37
} }
94
- children = { props => < Profile { ...props } /> }
95
- />
96
- </ Tab . Navigator >
38
+ tabBarOptions = { {
39
+ activeTintColor : '#161F3D' ,
40
+ showLabel : false ,
41
+ // style: {
42
+ // backgroundColor: 'transparent',
43
+ // borderTopWidth: 1,
44
+ // borderTopColor: 'transparent',
45
+ // position: 'absolute',
46
+ // left: 0,
47
+ // right: 0,
48
+ // bottom: 0,
49
+ // },
50
+ } } >
51
+ < Tab . Screen
52
+ name = "Home"
53
+ options = { {
54
+ tabBarIcon : ( { color, size} ) => (
55
+ < FontAwesome5 name = { 'home' } color = { color } size = { size } />
56
+ ) ,
57
+ } }
58
+ children = { ( ) => < Home { ...props } /> }
59
+ />
60
+ < Tab . Screen
61
+ name = "Message"
62
+ options = { {
63
+ tabBarIcon : ( { color, size} ) => (
64
+ < FontAwesome5 name = { 'comments' } color = { color } size = { size } />
65
+ ) ,
66
+ } }
67
+ children = { ( ) => < Message { ...props } /> }
68
+ />
69
+ < Tab . Screen
70
+ name = "Post"
71
+ options = { {
72
+ tabBarIcon : ( { color, size} ) => (
73
+ < AddButton />
74
+ // <FontAwesome5
75
+ // name={'plus-circle'}
76
+ // // color={'#E9446A'}
77
+ // size={44}
78
+ // style={{
79
+ // color: '#E9446A',
80
+ // shadowColor: '#E9446A',
81
+ // shadowOffset: {width: 0, height: 0},
82
+ // shadowRadius: 10,
83
+ // shadowOpacity: 0.3,
84
+ // }}
85
+ // />
86
+ ) ,
87
+ } }
88
+ // children={() => <Post {...props} />}
89
+ />
90
+ < Tab . Screen
91
+ name = "Notification"
92
+ options = { {
93
+ tabBarIcon : ( { color, size} ) => (
94
+ < FontAwesome5 name = { 'bell' } color = { color } size = { size } />
95
+ ) ,
96
+ } }
97
+ children = { ( ) => < Notification { ...props } /> }
98
+ />
99
+ < Tab . Screen
100
+ name = "Profile"
101
+ component = { Profile }
102
+ options = { {
103
+ tabBarIcon : ( { color, size} ) => (
104
+ < FontAwesome5 name = { 'user' } color = { color } size = { size } />
105
+ ) ,
106
+ } }
107
+ children = { props => < Profile { ...props } /> }
108
+ />
109
+ </ Tab . Navigator >
110
+ </ ImageBackground >
97
111
) ;
98
112
}
0 commit comments