-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
60 lines (56 loc) · 1.74 KB
/
App.tsx
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
import * as React from 'react';
import {NavigationContainer, useNavigation} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {
HeaderBackButton,
HeaderBackButtonProps,
} from '@react-navigation/elements';
import {View, Text} from 'src/components/common';
import routes, {HomeScreen, CameraScreen} from 'src/routes';
import testIds from 'src/test-ids';
import translate from 'src/locales';
import type {RootStackParamList} from 'src/types';
export function DetailsScreen() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Text>Details Screen</Text>
</View>
);
}
const Stack = createNativeStackNavigator<RootStackParamList>();
function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName={routes.Home}>
<Stack.Screen
name={routes.Home}
component={HomeScreen}
options={{title: translate('common.home')}}
/>
<Stack.Screen
name={routes.Details}
component={DetailsScreen}
options={{title: translate('common.details')}}
/>
<Stack.Screen
name={routes.Camera}
component={CameraScreen}
options={{
title: translate('common.camera'),
headerLeft: (props: HeaderBackButtonProps) => {
const navigation = useNavigation();
return (
<HeaderBackButton
{...props}
testID={testIds.page.camera.backButton}
onPress={navigation.goBack}
/>
);
},
}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;