|
| 1 | +import {NavigationContainer} from '@react-navigation/native'; |
| 2 | +import {useEffect, useRef, useState} from 'react'; |
| 3 | +import {requestPermissions} from './src/utils/permissions'; |
| 4 | +import AuthStackNavigator from './src/navigators/AuthStackNavigator'; |
| 5 | +import StackNavigator from './src/navigators/StackNavigator'; |
| 6 | +import {Toast} from 'react-native-toast-message/lib/src/Toast'; |
| 7 | +import MainTabNavigator from './src/navigators/MainTabNavigator'; |
| 8 | +import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; |
| 9 | +import Navigation from './src/utils/appNavigation'; |
| 10 | +import HomeStackNavigator from './src/navigators/HomeStackNavigator'; |
| 11 | +import React from 'react'; |
| 12 | +import {Provider} from 'react-redux'; |
| 13 | +import store from './src/redux/app/store'; |
| 14 | +import {persistStore} from 'redux-persist'; |
| 15 | +import {PersistGate} from 'redux-persist/integration/react'; |
| 16 | +import 'react-native-gesture-handler'; |
| 17 | +import {RootSiblingParent} from 'react-native-root-siblings'; |
| 18 | +import {GestureHandlerRootView} from 'react-native-gesture-handler'; |
| 19 | +import RNCallKeep, {IOptions} from 'react-native-callkeep'; |
| 20 | +import {AppRegistry, Platform, SafeAreaView} from 'react-native'; |
| 21 | +import * as OverlayPermissionModule from 'videosdk-rn-android-overlay-permission'; |
| 22 | +import {getChatData} from './src/utils/chat'; |
| 23 | +import {User} from './src/interface/types'; |
| 24 | +import Mapbox from '@rnmapbox/maps'; |
| 25 | +import {Settings} from 'react-native-fbsdk-next'; |
| 26 | + |
| 27 | +Mapbox.setAccessToken( |
| 28 | + 'sk.eyJ1IjoidXNtYW43NzciLCJhIjoiY2xvMGQ5MzQ1MTh4MjJ3bjByYnQ3ODZlNiJ9.CjbL2MyTL8IU8EE2jqko_w', |
| 29 | +); |
| 30 | + |
| 31 | +let persistor = persistStore(store); |
| 32 | + |
| 33 | +const App = () => { |
| 34 | + useEffect(() => { |
| 35 | + // Settings.setAppID('253076394397593'); |
| 36 | + Settings.initializeSDK(); |
| 37 | + |
| 38 | + () => { |
| 39 | + return; |
| 40 | + }; |
| 41 | + }, []); |
| 42 | + |
| 43 | + useEffect(() => { |
| 44 | + // RNCallKeep.setAvailable(true); |
| 45 | + |
| 46 | + if (Platform.OS === 'android') { |
| 47 | + OverlayPermissionModule.requestOverlayPermission(); |
| 48 | + } |
| 49 | + }, []); |
| 50 | + |
| 51 | + // const Tab = createBottomTabNavigator(); |
| 52 | + |
| 53 | + return ( |
| 54 | + <> |
| 55 | + <Provider store={store}> |
| 56 | + <PersistGate loading={null} persistor={persistor}> |
| 57 | + <RootSiblingParent> |
| 58 | + <GestureHandlerRootView style={{flex: 1}}> |
| 59 | + <NavigationContainer |
| 60 | + ref={Navigation.navigationRef} |
| 61 | + onStateChange={state => { |
| 62 | + // const previousRouteName = Navigation.routeNameRef.current; |
| 63 | + const currentRouteName = Navigation.getActiveRouteName(state); |
| 64 | + // if (previousRouteName !== currentRouteName) { |
| 65 | + // setCurrentScreen(currentRouteName); |
| 66 | + // } |
| 67 | + Navigation.routeNameRef.current = currentRouteName; |
| 68 | + }}> |
| 69 | + <SafeAreaView style={{backgroundColor: 'transparent', flex: 1}}> |
| 70 | + <StackNavigator /> |
| 71 | + </SafeAreaView> |
| 72 | + </NavigationContainer> |
| 73 | + </GestureHandlerRootView> |
| 74 | + </RootSiblingParent> |
| 75 | + </PersistGate> |
| 76 | + |
| 77 | + <Toast /> |
| 78 | + </Provider> |
| 79 | + </> |
| 80 | + ); |
| 81 | +}; |
| 82 | + |
| 83 | +export default App; |
0 commit comments