forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppNavigator.js
61 lines (53 loc) · 1.82 KB
/
AppNavigator.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
import MaterialCommunityIcons from '@expo/vector-icons/build/MaterialCommunityIcons';
import { createStackNavigator } from '@react-navigation/stack';
import * as React from 'react';
import Colors from './constants/Colors';
import SelectScreen from './screens/SelectScreen';
import RunTests from './screens/TestScreen';
// @tsapeta: This navigator is also being used by `bare-expo` app,
// so make sure it still works there once you change something here.
const Stack = createStackNavigator();
const spec = {
animation: 'timing',
config: {
duration: 0,
},
};
// TODO: Disable transition animations in E2E tests
const shouldDisableTransition = false;
const transitionSpec = shouldDisableTransition ? { open: spec, close: spec } : undefined;
export default function AppNavigator(props) {
React.useLayoutEffect(() => {
if (props.navigation) {
props.navigation.setOptions({
title: 'Tests',
tabBarLabel: 'Tests',
tabBarIcon: ({ focused }) => {
const color = focused ? Colors.activeTintColor : Colors.inactiveTintColor;
return <MaterialCommunityIcons name="format-list-checks" size={27} color={color} />;
},
});
}
}, [props.navigation]);
return (
<Stack.Navigator
{...props}
screenOptions={{
title: 'Tests',
transitionSpec,
headerBackTitle: 'Select',
headerTitleStyle: {
color: 'black',
},
headerTintColor: Colors.tintColor,
headerStyle: {
borderBottomWidth: 0.5,
borderBottomColor: 'rgba(0,0,0,0.1)',
boxShadow: '',
},
}}>
<Stack.Screen name="select" component={SelectScreen} options={{ title: 'Expo Test Suite' }} />
<Stack.Screen name="run" component={RunTests} options={{ title: 'Test Runner' }} />
</Stack.Navigator>
);
}