-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
67 lines (51 loc) · 2.51 KB
/
App.js
File metadata and controls
67 lines (51 loc) · 2.51 KB
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
import React from 'react';
import Home from './views/Home';
import { TeamHome } from './views/TeamHome';
import { DrawerContent } from './views/DrawerContent';
import { Basic, Delete } from './views/Basic';
import { Players, PlayerProfile } from './views/Players';
import { Partners } from './views/Partners';
import { Games } from './views/Games';
import { News } from './views/News';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { createStackNavigator } from '@react-navigation/stack';
import { DrawerActions } from '@react-navigation/native';
import { TouchableOpacity } from 'react-native';
import { Feather } from '@expo/vector-icons';
const Drawer = createDrawerNavigator();
const Stack = createStackNavigator();
/*
[global.team_img = 'https://kiekko-vantaa.fi/site/assets/files/2398/untitled1-edit-edit.jpg']
[global.default_img = 'https://kiekko-vantaa.fi/site/assets/files/2398/lohi.png']
*/
export default class App extends React.Component {
createHomeStack = () => {
return <Stack.Navigator>
<Stack.Screen name="Valitse joukkue:" component={Home} options={{ headerTitleAlign: 'center', }} />
<Stack.Screen name='Header' children={this.createDrawer} options={({ navigation }) => ({
headerRight: () => (<TouchableOpacity style={{ paddingRight: 10 }}>
<Feather name='menu' size={30} color='white' onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())} /></TouchableOpacity>)
})} />
</Stack.Navigator>
}
createDrawer = (props) => {
return <Drawer.Navigator drawerStyle={{ backgroundColor: null, width: '100%' }} drawerPosition="right" drawerContent={props => <DrawerContent{...props} />}>
<Drawer.Screen name='Etusivu' component={TeamHome} initialParams={{ domain: props.route.params.domain, name: props.route.params.name, logo: props.route.params.logo, color: props.route.params.color }} />
<Drawer.Screen name='Pelaajat' component={Players} />
<Drawer.Screen name='PelaajaProfiili' component={PlayerProfile} initialParams={{ profile_img: props.route.params.profile_img }} />
<Drawer.Screen name='Ottelut' component={Games} />
<Drawer.Screen name='Kumppanit' component={Partners} />
<Drawer.Screen name='Sivu' component={Basic} />
<Drawer.Screen name='Uutiset' component={News} />
<Drawer.Screen name='Poista tallennettu joukkue' component={Delete} />
</Drawer.Navigator>
}
render() {
return (
<NavigationContainer>
{ this.createHomeStack()}
</NavigationContainer>
);
}
}