-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAppBackup.js
182 lines (165 loc) · 4.62 KB
/
AppBackup.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import HomeScreen from './src/screens/HomeScreen';
import LoginScreen from './src/screens/LoginScreen';
import DetailScreen from './src/screens/DetailScreen';
import {Button} from 'react-native';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import Icons from 'react-native-vector-icons/Ionicons';
import VectorIcons from './src/components/Icons';
Icons.loadFont();
const Stack = createStackNavigator();
function StackNavigator() {
return (
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerLeft: () => (
<Button
title="Info"
onPress={() => alert('Infoya bastınız')}
color="white"
/>
),
headerRight: () => (
<Button
title="Sepet Boşalt"
onPress={() => alert('Sepeti boşalttım!!')}
color="white"
/>
),
}}>
{/* <Stack.Group
screenOptions={{
headerStyle: {backgroundColor: 'tomato'},
headerTitleStyle: {
color: 'white',
fontWeight: 'bold',
},
headerBackTitleStyle: {color: 'white'},
}}>
<Stack.Screen
component={HomeScreen}
name="Home"
options={{title: 'Ana Sayfa'}}
/>
<Stack.Screen
component={DetailScreen}
name="Detail"
options={{title: 'Detay'}}
initialParams={{age: 35, isShowTitle: false}}
/>
</Stack.Group> */}
<Stack.Group
screenOptions={{
presentation: 'modal',
}}>
<Stack.Screen
component={LoginScreen}
name="Login"
options={{
title: 'Giriş Yap',
headerShown: false,
gestureEnabled: false,
}}
/>
<Stack.Screen name="CustomStack">
{props => (
<HomeScreen
{...props}
extraData={[
{title: 'HEYASD'},
{title: 'HEYASD'},
{title: 'HEYASD'},
]}
/>
)}
</Stack.Screen>
</Stack.Group>
</Stack.Navigator>
);
}
const Tab = createBottomTabNavigator();
const TabNavigator = () => {
return (
<Tab.Navigator
screenOptions={route =>
console.log('Route', route.route.name) || {
tabBarActiveTintColor: 'tomato',
tabBarInactiveTintColor: 'gray',
tabBarIcon: ({focused}) => {
const {name} = route.route;
let icon = '';
if (name === screenName.home) {
icon = 'home-outline';
}
if (name === screenName.detail) {
icon = 'build-outline';
}
if (name === screenName.login) {
icon = 'chatbox-ellipses-outline';
}
if (name === screenName.root) {
icon = 'chatbox-ellipses-outline';
}
return <VectorIcons size={25} name={icon} focused={focused} />;
},
}
}>
<Tab.Screen
name="Root"
component={StackNavigator}
options={{title: 'Giriş Yap'}}
/>
<Tab.Screen
name={screenName.home}
component={HomeScreen}
options={{
title: 'Ana sayfa',
tabBarBadge: 3,
tabBarBadgeStyle: {backgroundColor: 'pink', color: 'white'},
// tabBarIcon: ({focused}) => (
// <VectorIcons size={25} name="home-outline" focused={focused} />
// ),
}}
/>
<Tab.Screen
name={screenName.detail}
component={DetailScreen}
initialParams={{name: 'FURKAN', surname: 'TÜRKYILMAZ'}}
options={{
title: 'Detay',
// tabBarIcon: ({focused}) => (
// <VectorIcons name="build-outline" size={24} focused={focused} />
// ),
}}
/>
{/* <Tab.Screen
name={screenName.login}
component={LoginScreen}
initialParams={{text: 'FURKAN'}}
options={{
title: 'Giriş',
tabBarIcon: ({focused}) => (
<VectorIcons
name="chatbox-ellipses-outline"
size={24}
focused={focused}
/>
),
}}
/> */}
</Tab.Navigator>
);
};
//react native vector icons
const screenName = {
home: 'Home',
detail: 'Detail',
login: 'Login',
root: 'Root',
};
export default function App() {
return <NavigationContainer>{TabNavigator()}</NavigationContainer>;
}