Skip to content

Commit 73129c5

Browse files
committed
chore: settings imports and declaration
1 parent 1c60b81 commit 73129c5

File tree

4 files changed

+41
-48
lines changed

4 files changed

+41
-48
lines changed

template/App.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
import React from 'react';
22
import { useNavigationMounting } from 'navigation/RootNavigation';
3-
import { log } from '@utils/console';
43
import 'localization';
54
import Router from 'navigation/Router';
6-
import { enableScreens } from 'react-native-screens';
75
import { FileLogger } from 'react-native-file-logger';
86
import { SENTRY_DSN, ENV, ONESIGNAL_ANDROID_KEY } from '@env';
97
import * as Sentry from '@sentry/react-native';
108
import codePush, { CodePushOptions } from 'react-native-code-push';
11-
import useNetworkError from 'hooks/useNetworkError';
12-
import useStartupTime from 'hooks/useStartupTime';
13-
import useOneSignal from 'hooks/useOneSignal';
149
import useAppState from 'react-native-appstate-hook';
1510
import { Provider } from 'react-redux';
16-
import store from './src/store';
11+
import store from '@store/index';
1712
import { QueryClient, QueryClientProvider } from 'react-query';
13+
import { warn } from '@utils/console';
14+
import { theme } from 'theme';
15+
import { ThemeProvider } from 'styled-components';
1816

19-
enableScreens();
2017
FileLogger.configure({
2118
maximumFileSize: 1024 * 1024 * 5, // 5MB,
2219
maximumNumberOfFiles: 3,
2320
});
2421

25-
log({ ENV, SENTRY_DSN, ONESIGNAL_ANDROID_KEY });
26-
2722
if (typeof SENTRY_DSN === 'string' && SENTRY_DSN.length > 0) {
2823
const routingInstrumentation = new Sentry.ReactNavigationV5Instrumentation();
2924

@@ -41,22 +36,19 @@ const queryClient = new QueryClient();
4136

4237
const App = () => {
4338
useNavigationMounting();
44-
useOneSignal();
45-
useStartupTime();
46-
47-
useNetworkError();
4839

4940
useAppState({
50-
onChange: (newAppState) =>
51-
console.warn('App state changed to ', newAppState),
52-
onForeground: () => console.warn('App went to Foreground'),
53-
onBackground: () => console.warn('App went to background'),
41+
onChange: (newAppState) => warn('App state changed to ', newAppState),
42+
onForeground: () => warn('App went to Foreground'),
43+
onBackground: () => warn('App went to background'),
5444
});
5545

5646
return (
5747
<Provider store={store}>
5848
<QueryClientProvider client={queryClient}>
59-
<Router />
49+
<ThemeProvider theme={theme}>
50+
<Router />
51+
</ThemeProvider>
6052
</QueryClientProvider>
6153
</Provider>
6254
);

template/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { AppRegistry, LogBox } from 'react-native';
22
import App from './App';
33
import { name as appName } from './app.json';
44
import getStorybookUI from './storybook';
5-
5+
import { enableScreens } from 'react-native-screens';
6+
enableScreens();
67
LogBox.ignoreLogs(['Setting a timer']);
78
let EntryPoint;
89
const showStorybook = false;

template/src/navigation/Router.tsx

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import React from 'react';
22
import { LinkingOptions, NavigationContainer } from '@react-navigation/native';
33
import { createStackNavigator } from '@react-navigation/stack';
44

5-
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
5+
import { SafeAreaProvider } from 'react-native-safe-area-context';
66
import { navigationRef } from 'navigation/RootNavigation';
77

88
import { commonScreens, CommonStackParamList } from 'screens';
9-
import { ThemeProvider } from 'styled-components';
109
import { theme } from '../../theme';
1110
import RNBootSplash from 'react-native-bootsplash';
1211

@@ -27,32 +26,30 @@ const linking: LinkingOptions = {
2726

2827
export default function Router() {
2928
return (
30-
<ThemeProvider theme={theme}>
31-
<NavigationContainer
32-
linking={linking}
33-
ref={navigationRef}
34-
onReady={() => {
35-
setTimeout(() => {
36-
RNBootSplash.hide({ fade: true }); // fade
37-
}, 3000);
38-
}}>
39-
<SafeAreaProvider>
40-
<Stack.Navigator screenOptions={screenOptions}>
41-
{Object.entries({
42-
// Use the screens normally
43-
...commonScreens,
44-
}).map(([name, props]) => {
45-
return (
46-
<Stack.Screen
47-
key={name}
48-
name={name as keyof ParamList}
49-
{...props}
50-
/>
51-
);
52-
})}
53-
</Stack.Navigator>
54-
</SafeAreaProvider>
55-
</NavigationContainer>
56-
</ThemeProvider>
29+
<NavigationContainer
30+
linking={linking}
31+
ref={navigationRef}
32+
onReady={() => {
33+
setTimeout(() => {
34+
RNBootSplash.hide({ fade: true }); // fade
35+
}, 3000);
36+
}}>
37+
<SafeAreaProvider>
38+
<Stack.Navigator screenOptions={screenOptions}>
39+
{Object.entries({
40+
// Use the screens normally
41+
...commonScreens,
42+
}).map(([name, props]) => {
43+
return (
44+
<Stack.Screen
45+
key={name}
46+
name={name as keyof ParamList}
47+
{...props}
48+
/>
49+
);
50+
})}
51+
</Stack.Navigator>
52+
</SafeAreaProvider>
53+
</NavigationContainer>
5754
);
5855
}

template/src/screens/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import HomeScreen from 'screens/Home';
22
import CustomWebView from 'screens/CharacterDetail';
3+
/* PLOP_INJECT_IMPORT */
34
import { StackNavigationOptions } from '@react-navigation/stack';
45
import { IPeople } from 'src/interfaces/IPeople';
56

67
export type CommonStackParamList = {
78
CharacterDetail: { character: IPeople };
89
Home: undefined;
10+
/* PLOP_INJECT_TYPE */
911
};
1012

1113
const options: StackNavigationOptions = { gestureEnabled: false };
1214

1315
export const commonScreens = {
1416
Home: { component: HomeScreen, options },
1517
CharacterDetail: { component: CustomWebView },
18+
/* PLOP_INJECT_SCREEN */
1619
};

0 commit comments

Comments
 (0)