-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
85 lines (76 loc) · 2.57 KB
/
App.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
import React from 'react';
import {StatusBar, useColorScheme} from 'react-native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import FooterTextInput from './src/FooterTextInput';
import FooterTextInputWithoutSpellCheck from './src/FooterTextInputWithoutSpellCheck';
import AvoidForm from './src/AvoidForm';
import FooterButton from './src/FooterButton';
import FooterTextInputWithTab from './src/FooterTextInputWithTab';
import FooterButtonWithTab from './src/FooterButtonWithTab';
import {getFocusedRouteNameFromRoute} from '@react-navigation/native';
function getHeaderTitle(route) {
const routeName =
getFocusedRouteNameFromRoute(route) ?? 'FooterTextInputWithTab';
switch (routeName) {
case 'FooterTextInputWithTab':
return 'Sticky Input w/Tab';
case 'FooterButtonWithTab':
return 'Sticky Button w/Tab';
}
}
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
function BottomTab() {
return (
<Tab.Navigator>
<Tab.Screen
name="FooterTextInputWithTab"
component={FooterTextInputWithTab}
/>
<Tab.Screen name="FooterButtonWithTab" component={FooterButtonWithTab} />
</Tab.Navigator>
);
}
const App = () => {
const isDarkMode = useColorScheme() === 'dark';
return (
<SafeAreaProvider>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="FooterTextInput"
component={FooterTextInput}
options={{title: 'Sticky Input'}}
/>
<Stack.Screen
name="FooterTextInputWithoutSpellCheck"
component={FooterTextInputWithoutSpellCheck}
options={{title: 'Sticky Input w/o SpecllCheck'}}
/>
<Stack.Screen
name="AvoidForm"
component={AvoidForm}
options={{title: 'Many Input Avoid'}}
/>
<Stack.Screen
name="FooterButton"
component={FooterButton}
options={{title: 'Sticky Button'}}
/>
<Stack.Screen
name="BottomTab"
component={BottomTab}
options={({route}) => ({
headerTitle: getHeaderTitle(route),
})}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
};
export default App;