-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
69 lines (57 loc) · 1.81 KB
/
App.js
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
import 'react-native-gesture-handler'
import React, { useEffect } from 'react'
import { QueryClient, QueryClientProvider } from 'react-query'
import { LogBox, Linking } from 'react-native'
import * as Sentry from 'sentry-expo'
import * as Localization from 'expo-localization'
import i18n from 'i18n-js'
import urlParse from 'url-parse'
import Toast from 'react-native-toast-message'
import { Logs } from 'expo'
import CompleteFlow from './navigation/CompleteFlow'
import * as RootNavigation from './navigation/RootNavigation'
import Store from './filters/Store'
import { en, es, pt, jp, zh, ru, ph, de } from './i18n/supportedLanguages'
Logs.enableExpoCliLogging()
Sentry.init({
dsn: 'https://[email protected]/5691192',
enableInExpoDevelopment: true,
debug: true
})
i18n.fallbacks = true
i18n.translations = { en, es, pt, jp, zh, ru, ph, de }
i18n.locale = Localization.locale
LogBox.ignoreLogs(['Setting a timer'])
const App = () => {
const queryClient = new QueryClient();
useEffect(() => {
const handleUrl = async (url) => {
const parsedUrl = urlParse(url, true)
const parts = parsedUrl.pathname.split('/')
if (parts.length === 2 && parts[1].length > 0) {
const category_id = parseInt(parts[1])
RootNavigation.navigate('ListEvents', { category_id: category_id })
}
};
Linking.addEventListener('url', ({ url }) => {
handleUrl(url)
});
Linking.getInitialURL().then((url) => {
if (url) {
handleUrl(url)
}
});
return () => {
Linking.removeEventListener('url')
};
}, []);
return (
<QueryClientProvider client={queryClient}>
<Store>
<CompleteFlow/>
<Toast />
</Store>
</QueryClientProvider>
)
}
export default Sentry.Native.wrap(App)