-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathApp.tsx
More file actions
60 lines (52 loc) · 1.65 KB
/
Copy pathApp.tsx
File metadata and controls
60 lines (52 loc) · 1.65 KB
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 'react-native-gesture-handler';
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import * as FileSystem from 'expo-file-system';
import Browser from './components/Browser';
import PDFViewer from './components/PDFViewer';
if (typeof Intl === 'undefined') {
require('intl');
require('intl/locale-data/jsonp/en');
}
type StackParams = {
Browser: {currDir: string; path: string};
PDFViewer: {currDir: string; path: string};
MiscFileViewer: {currDir: string; path: string};
};
const Stack = createStackNavigator<StackParams>();
export default function App() {
const root: string = FileSystem.documentDirectory || '';
const path = root.endsWith('/') ? root.substring(0, root.length - 1) : root;
return (
<SafeAreaProvider>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Browser"
screenOptions={{
headerShown: false,
}}>
<Stack.Screen
name="Browser"
component={Browser}
initialParams={{
path: path,
currDir: 'Browser',
}}
options={({route}) => ({
title: route?.params?.currDir || 'Browser',
})}
/>
<Stack.Screen
name="PDFViewer"
component={PDFViewer}
options={({route}) => ({
title: route?.params?.currDir || 'PDFViewer',
})}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
}