-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.tsx
110 lines (99 loc) Β· 3.29 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// μ€ν λ¦¬λΆ μ€νμ μνλ€λ©΄ μ£Όμν΄μ
// import StorybookUIRoot from './.ondevice/Storybook';
import { useFlipper } from '@react-navigation/devtools';
import {
NavigationContainer,
useNavigationContainerRef,
} from '@react-navigation/native';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import FallbackError from 'components/fallback/FallbackError';
import Navigator from 'navigators/Navigator';
import { useEffect } from 'react';
import {
SafeAreaView,
StatusBar,
StyleSheet,
Text,
TextInput,
} from 'react-native';
import ErrorBoundary from 'react-native-error-boundary';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import SplashScreen from 'react-native-splash-screen';
import { MyTheme, colors } from 'styles/theme';
import DialogPortalProvider from 'components/common/dialogs/DialogPortalProvider';
const appStyles = StyleSheet.create({
gestureContainer: {
flex: 1,
},
safeAreaContainer: {
flex: 1,
backgroundColor: colors.background,
},
});
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 0,
staleTime: 1000 * 60 * 3, // 3λΆ
refetchOnWindowFocus: false,
useErrorBoundary: true,
suspense: true,
},
mutations: {
useErrorBoundary: true,
retry: 0,
},
},
});
if (__DEV__) {
import('react-query-native-devtools').then(({ addPlugin }) => {
addPlugin({ queryClient });
});
}
const App = () => {
const navigationRef = useNavigationContainerRef();
useFlipper(navigationRef);
useEffect(() => {
const timer = setTimeout(() => SplashScreen.hide(), 2000);
return () => clearTimeout(timer);
}, []);
return (
<QueryClientProvider client={queryClient}>
<ErrorBoundary FallbackComponent={FallbackError}>
<SafeAreaView style={appStyles.safeAreaContainer}>
<GestureHandlerRootView style={appStyles.gestureContainer}>
<NavigationContainer theme={MyTheme} ref={navigationRef}>
<DialogPortalProvider>
{/* <StorybookUIRoot /> */}
{/* μ€ν λ¦¬λΆ μ€νμ μνλ€λ©΄ μ μ£Όμν΄μ , μλ μ£Όμμ²λ¦¬ */}
<StatusBar
backgroundColor={colors.background}
barStyle="light-content"
/>
<Navigator />
</DialogPortalProvider>
</NavigationContainer>
</GestureHandlerRootView>
</SafeAreaView>
</ErrorBoundary>
</QueryClientProvider>
);
};
// μ λμ ν°νΈ ν¬κΈ° μ ν
interface TextWithDefaultProps extends Text {
defaultProps?: { allowFontScaling?: boolean };
}
(Text as unknown as TextWithDefaultProps).defaultProps =
(Text as unknown as TextWithDefaultProps).defaultProps || {};
(Text as unknown as TextWithDefaultProps).defaultProps!.allowFontScaling =
false;
interface TextInputWithDefaultProps extends TextInput {
defaultProps?: { allowFontScaling?: boolean; padding?: number };
}
(TextInput as unknown as TextInputWithDefaultProps).defaultProps =
(TextInput as unknown as TextInputWithDefaultProps).defaultProps || {};
(
TextInput as unknown as TextInputWithDefaultProps
).defaultProps!.allowFontScaling = false;
(TextInput as unknown as TextInputWithDefaultProps).defaultProps!.padding = 0;
export default App;