-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
47 lines (43 loc) · 1.38 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
import 'react-native-gesture-handler'
import React from 'react'
import { QueryClientProvider, QueryClient } from 'react-query'
import PokemonList from '@screens/pokemon-list'
import PokemonDetails from '@screens/pokemon-details'
import { NavigationContainer, DefaultTheme } from '@react-navigation/native'
import { createSharedElementStackNavigator } from 'react-navigation-shared-element'
const queryClient = new QueryClient()
const Stack = createSharedElementStackNavigator()
const options = {
headerBackTitleVisible: false,
cardStyleInterpolator: ({ current: { progress } }: any) => {
return {
cardStyle: {
opacity: progress,
},
}
},
}
export default function App() {
return (
<QueryClientProvider client={queryClient}>
<NavigationContainer theme={{ ...DefaultTheme, colors: { ...DefaultTheme.colors, background: 'white' } }}>
<Stack.Navigator screenOptions={{ headerShown: false }} mode={'card'}>
<Stack.Screen component={PokemonList} name={'List'} options={options} />
<Stack.Screen
component={PokemonDetails}
name={'Details'}
options={options}
sharedElements={(route) => {
const { item } = route.params
return [
`pokemon.${item.name}.types`,
`pokemon.${item.name}.number`,
`pokemon.${item.name}.image`,
]
}}
/>
</Stack.Navigator>
</NavigationContainer>
</QueryClientProvider>
)
}