Skip to content

Commit e25446e

Browse files
committed
type fix
1 parent 2366d1b commit e25446e

File tree

5 files changed

+41
-258
lines changed

5 files changed

+41
-258
lines changed

App.tsx

-118
This file was deleted.

ios/MangaReader/Info.plist

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>UIAppFonts</key>
6-
<array>
7-
<string>MaterialIcons.ttf</string>
8-
<string>MaterialCommunityIcons.ttf</string>
9-
<string>Octicons.ttf</string>
10-
</array>
115
<key>CFBundleDevelopmentRegion</key>
126
<string>en</string>
137
<key>CFBundleDisplayName</key>
@@ -47,6 +41,12 @@
4741
<string></string>
4842
<key>NSPhotoLibraryUsageDescription</key>
4943
<string></string>
44+
<key>UIAppFonts</key>
45+
<array>
46+
<string>MaterialIcons.ttf</string>
47+
<string>MaterialCommunityIcons.ttf</string>
48+
<string>Octicons.ttf</string>
49+
</array>
5050
<key>UILaunchStoryboardName</key>
5151
<string>LaunchScreen</string>
5252
<key>UIRequiredDeviceCapabilities</key>

src/App.tsx

+17-35
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
1-
import React, { useState, useEffect, Fragment } from 'react';
1+
import React, { useState, useEffect, useCallback } from 'react';
2+
import { createNativeStackNavigator, NativeStackHeaderProps } from '@react-navigation/native-stack';
23
import { navigationRef, customTheme, AsyncStatus } from '~/utils';
3-
import { createNativeStackNavigator } from '@react-navigation/native-stack';
4+
import { HeartAndBrowser, PrehandleDrawer } from '~/views/Detail';
5+
import { SearchAndPlugin, PluginSelect } from '~/views/Discovery';
46
import { GestureHandlerRootView } from 'react-native-gesture-handler';
57
import { store, useAppSelector } from '~/redux';
68
import { NavigationContainer } from '@react-navigation/native';
79
import { NativeBaseProvider } from 'native-base';
810
import { useMessageToast } from '~/hooks';
11+
import { SearchAndAbout } from '~/views/Home';
912
import { StyleSheet } from 'react-native';
1013
import { Provider } from 'react-redux';
1114
import RNBootSplash from 'react-native-bootsplash';
1215
import loadable from '@loadable/component';
16+
import Header from '~/components/Header';
1317

1418
interface NavigationScreenProps {
1519
ready?: boolean;
1620
}
1721

18-
const Header = loadable(() => import('~/components/Header'));
1922
const Home = loadable(() => import('~/views/Home'));
20-
const SearchAndAbout = loadable(() => import('~/views/Home'), {
21-
resolveComponent: (components) => components.SearchAndAbout,
22-
});
2323
const Search = loadable(() => import('~/views/Search'));
2424
const Discovery = loadable(() => import('~/views/Discovery'));
25-
const SearchAndPlugin = loadable(() => import('~/views/Discovery'), {
26-
resolveComponent: (components) => components.SearchAndPlugin,
27-
});
28-
const PluginSelect = loadable(() => import('~/views/Discovery'), {
29-
resolveComponent: (components) => components.PluginSelect,
30-
});
3125
const Detail = loadable(() => import('~/views/Detail'));
32-
const HeartAndBrowser = loadable(() => import('~/views/Detail'), {
33-
resolveComponent: (components) => components.HeartAndBrowser,
34-
});
35-
const PrehandleDrawer = loadable(() => import('~/views/Detail'), {
36-
resolveComponent: (components) => components.PrehandleDrawer,
37-
});
3826
const Chapter = loadable(() => import('~/views/Chapter'));
3927
const Plugin = loadable(() => import('~/views/Plugin'));
4028
const Webview = loadable(() => import('~/views/Webview'));
@@ -48,6 +36,11 @@ const NavigationScreen = ({ ready = false }: NavigationScreenProps) => {
4836
const latestRelease = useAppSelector((state) => state.release.latest);
4937
const haveUpdate = Boolean(latestRelease);
5038

39+
const DefaultHeader = useCallback(
40+
(props: NativeStackHeaderProps) => <Header {...props} enableShake={haveUpdate} />,
41+
[haveUpdate]
42+
);
43+
5144
useEffect(() => {
5245
if (ready && launchStatus === AsyncStatus.Fulfilled) {
5346
RNBootSplash.hide();
@@ -56,20 +49,17 @@ const NavigationScreen = ({ ready = false }: NavigationScreenProps) => {
5649
useMessageToast();
5750

5851
return (
59-
<Navigator
60-
initialRouteName="Home"
61-
screenOptions={{ header: (props) => <Header {...props} enableShake={haveUpdate} /> }}
62-
>
63-
<Screen name="Home" options={{ headerRight: () => <SearchAndAbout /> }} component={Home} />
52+
<Navigator initialRouteName="Home" screenOptions={{ header: DefaultHeader }}>
53+
<Screen name="Home" options={{ headerRight: SearchAndAbout }} component={Home} />
6454
<Screen
6555
name="Discovery"
66-
options={{ title: '', headerLeft: () => <SearchAndPlugin /> }}
56+
options={{ title: '', headerLeft: SearchAndPlugin }}
6757
component={Discovery}
6858
/>
69-
<Screen name="Search" options={{ headerRight: () => <PluginSelect /> }} component={Search} />
59+
<Screen name="Search" options={{ headerRight: PluginSelect }} component={Search} />
7060
<Screen
7161
name="Detail"
72-
options={{ title: 'loading...', headerRight: () => <HeartAndBrowser /> }}
62+
options={{ title: 'loading...', headerRight: HeartAndBrowser }}
7363
component={Detail}
7464
/>
7565
<Screen name="Chapter" options={{ headerShown: false }} component={Chapter} />
@@ -80,14 +70,6 @@ const NavigationScreen = ({ ready = false }: NavigationScreenProps) => {
8070
);
8171
};
8272

83-
const ModalWrapper = () => {
84-
return (
85-
<Fragment>
86-
<PrehandleDrawer />
87-
</Fragment>
88-
);
89-
};
90-
9173
const App = () => {
9274
const [ready, setReady] = useState(false);
9375

@@ -97,7 +79,7 @@ const App = () => {
9779
<NativeBaseProvider theme={customTheme}>
9880
<NavigationContainer ref={navigationRef} onReady={() => setReady(true)}>
9981
<NavigationScreen ready={ready} />
100-
<ModalWrapper />
82+
<PrehandleDrawer />
10183
</NavigationContainer>
10284
</NativeBaseProvider>
10385
</Provider>

src/views/Scan.tsx

-97
This file was deleted.

tsconfig.json

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
{
22
"extends": "@tsconfig/react-native/tsconfig.json",
33
"compilerOptions": {
4+
"lib": [
5+
"es2019",
6+
"es2020.bigint",
7+
"es2020.date",
8+
"es2020.number",
9+
"es2020.promise",
10+
"es2020.string",
11+
"es2020.symbol.wellknown",
12+
"es2021.promise",
13+
"es2021.string",
14+
"es2021.weakref",
15+
"es2022.array",
16+
"es2022.object",
17+
"es2022.string",
18+
"dom"
19+
],
420
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
521
"paths": {
622
"~/*": ["src/*"]
7-
},
8-
},
23+
}
24+
}
925
}

0 commit comments

Comments
 (0)