-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathindex.tsx
48 lines (43 loc) · 1.34 KB
/
index.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
import * as React from 'react';
import { useWindowDimensions } from 'react-native';
import { Reader, ReaderProvider } from '@epubjs-react-native/core';
import { useFileSystem } from '@epubjs-react-native/expo-file-system';
import { BottomSheetModal } from '@gorhom/bottom-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { Header } from './Header';
import { SearchList } from './SearchList';
function Inner() {
const { height } = useWindowDimensions();
const insets = useSafeAreaInsets();
const searchListRef = React.useRef<BottomSheetModal>(null);
return (
<GestureHandlerRootView
style={{
flex: 1,
paddingTop: insets.top,
paddingBottom: insets.bottom,
paddingLeft: insets.left,
paddingRight: insets.right,
}}
>
<Header onPressSearch={() => searchListRef.current?.present()} />
<Reader
src="https://s3.amazonaws.com/moby-dick/OPS/package.opf"
height={height * 0.8}
fileSystem={useFileSystem}
/>
<SearchList
ref={searchListRef}
onClose={() => searchListRef.current?.dismiss()}
/>
</GestureHandlerRootView>
);
}
export function Search() {
return (
<ReaderProvider>
<Inner />
</ReaderProvider>
);
}