This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
54 lines (47 loc) · 1.72 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
import 'react-native-gesture-handler'
import React, { useMemo } from 'react'
import { DefaultTheme, NavigationContainer } from '@react-navigation/native'
import { ThemeProvider } from 'styled-components/native'
import { Provider } from 'react-redux'
import { MemoryGamePersistor, MemoryGameStore, useMemoryGameSelector } from './src/Reducers/MemoryGameReducer'
import { StatusBar } from 'react-native'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { PersistGate } from 'redux-persist/integration/react'
import { ComponentModalsContextProvider } from 'Components/useModalComponent'
import { enableScreens } from 'react-native-screens'
import Theme from './src/Utils/Theme'
import FullModalNavigator from './src/Navigators/FullModalNavigator'
enableScreens()
const NavigationTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: Theme.colors.background,
},
}
const App = () => {
const current_player = useMemoryGameSelector(state => state.current_player)
// Muda a cor do tema sempre o que player mudar de avatar
const theme = useMemo(() => ({
...Theme, colors: { ...Theme.colors, primary: current_player.avatar.color },
}), [current_player.avatar.color])
return (
<SafeAreaProvider>
<ThemeProvider theme={theme}>
<StatusBar hidden />
<ComponentModalsContextProvider>
<NavigationContainer theme={NavigationTheme}>
<FullModalNavigator />
</NavigationContainer>
</ComponentModalsContextProvider>
</ThemeProvider>
</SafeAreaProvider>
)
}
export default () => (
<Provider store={MemoryGameStore}>
<PersistGate persistor={MemoryGamePersistor}>
<App />
</PersistGate>
</Provider>
)