This repository has been archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
/
App.tsx
65 lines (57 loc) · 1.83 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
import React, { useEffect } from "react"
import { YellowBox, Platform, UIManager } from "react-native"
import { Provider } from "react-redux"
import reactotron from "reactotron-react-native"
import { PersistGate } from "redux-persist/integration/react"
import GreenIndicator from "./src/common/components/GreenIndicator"
import AppWithNavigation from "./src/features/navigation"
import { persistor, store } from "./src/redux/store"
import SplashScreen from "react-native-splash-screen"
import ErrorBoundary from "./ErrorBoundary"
function setup() {
if (__DEV__) {
import("./reactotron").then(() => {
reactotron.clear!()
console.log("Reactotron Configured")
})
}
/**
* SafeView: from react-navigation library.
*
* 180000ms: React Native complains that although the interval
* keeps on running in the background, it cannot be called.
* In this particular case calling getRecentlyPlayed() when the
* app comes to foreground is the better UX.
*
* ERR_CONNECTION_REFUSED / Encountered an error loading page: Android / iOS in the login webview,
* we navigate to localhost which refuses connection.
*/
YellowBox.ignoreWarnings([
"SafeView",
"180000ms",
"ERR_CONNECTION_REFUSED",
"Encountered an error loading page",
])
if (Platform.OS === "android") {
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true)
}
}
}
setup()
const AppWithStore = () => {
useEffect(() => {
SplashScreen.hide()
}, [])
return (
<ErrorBoundary>
<Provider store={store}>
<PersistGate loading={<GreenIndicator />} persistor={persistor}>
<AppWithNavigation />
</PersistGate>
</Provider>
</ErrorBoundary>
)
}
const App = __DEV__ ? reactotron.overlay(AppWithStore) : AppWithStore
export default App