-
Notifications
You must be signed in to change notification settings - Fork 11
/
Routes.js
120 lines (106 loc) · 3.71 KB
/
Routes.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import analytics from '@react-native-firebase/analytics';
// import { createStackNavigator, TransitionSpecs } from '@react-navigation/stack';
import {CardStyleInterpolators, createStackNavigator} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {NavigationContainer, DefaultTheme} from '@react-navigation/native';
import React, {useRef} from 'react';
import 'react-native-gesture-handler';
import {Provider as StoreProvider} from 'react-redux';
import codePush from 'react-native-code-push';
import Error from './src/components/Error';
import Home from './src/components/Home';
import MiniPlayer from './src/components/MiniPlayer';
import Playlist from './src/components/Playlist';
import LibraryStack from './src/navigation/LibraryStack';
import TabBar from './src/navigation/TabBar';
import store from './src/redux/store';
import NewStack from './src/navigation/NewStack';
import DownloadingHelper from './src/components/DownloadingHelper';
import {View} from 'react-native';
import Player from './src/components/Player';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const BottomNav = () => {
return (
<Tab.Navigator
tabBar={(props) => <TabBar {...props} />}
initialRouteName="Home">
<Tab.Screen
options={{headerShown: false}}
component={Home}
name="Home"></Tab.Screen>
<Tab.Screen
component={NewStack}
name="NewStack"
options={{
headerShown: false,
// unmountOnBlur: true,
}}></Tab.Screen>
<Tab.Screen
options={{headerShown: false}}
component={LibraryStack}
name="LibraryStack"></Tab.Screen>
{/* <Tab.Screen
component={Playlist}
name="Playlist"
options={{
headerShown: false,
// unmountOnBlur: true,
}}></Tab.Screen> */}
<Tab.Screen
component={Error}
name="Error"
options={{unmountOnBlur: true}}></Tab.Screen>
</Tab.Navigator>
);
};
const RootStack = () => {
const navigationRef = useRef();
const routeNameRef = useRef();
const MyTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: '#181818',
},
};
return (
<StoreProvider store={store}>
<NavigationContainer
theme={MyTheme}
ref={navigationRef}
onReady={() =>
(routeNameRef.current = navigationRef.current.getCurrentRoute().name)
}
onStateChange={async (state) => {
const previousRouteName = routeNameRef.current;
const currentRouteName = navigationRef.current.getCurrentRoute().name;
if (previousRouteName !== currentRouteName) {
await analytics().logScreenView({
screen_name: currentRouteName,
screen_class: currentRouteName,
});
}
}}>
<Stack.Navigator
screenOptions={{
cardStyle: {backgroundColor: 'transparent'},
headerShown: false,
}}
initialRouteName="BottomNav">
<Stack.Screen name="BottomNav" component={BottomNav} />
<Stack.Screen name={'Player'} component={Player} options={{
// presentation: 'modal',
cardOverlayEnabled: true,
cardStyleInterpolator: CardStyleInterpolators.forModalPresentationIOS,
gestureEnabled : false,
}}/>
</Stack.Navigator>
<DownloadingHelper />
<MiniPlayer />
</NavigationContainer>
</StoreProvider>
);
};
export default codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(RootStack);
// appcenter codepush release-react -a samadritsarkar2/Downify