verdnatura-chat/app/navigation.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-08-09 16:19:17 +00:00
import React from 'react';
import { Button } from 'react-native';
2017-08-03 18:23:43 +00:00
import { StackNavigator } from 'react-navigation';
2017-08-09 01:40:55 +00:00
import LoginView from './views/login';
import NewServerView from './views/serverNew';
import ListServerView from './views/serverList';
import RoomsListView from './views/roomsList';
import RoomView from './views/room';
2017-08-03 18:23:43 +00:00
2017-08-09 16:19:17 +00:00
const MainCardNavigator = StackNavigator({
Rooms: {
screen: RoomsListView,
navigationOptions: ({ navigation }) => ({
headerLeft: <Button title='Servers' onPress={() => navigation.navigate('ListServerModal')} />
})
2017-08-07 00:34:35 +00:00
},
Room: {
screen: RoomView
// navigationOptions: {
// header: null
// }
}
2017-08-03 18:23:43 +00:00
}, {
2017-08-09 16:19:17 +00:00
initialRouteName: 'Rooms',
2017-08-03 18:23:43 +00:00
cardStyle: {
backgroundColor: '#fff'
}
});
2017-08-09 16:19:17 +00:00
export default new StackNavigator({
Main: {
screen: MainCardNavigator,
navigationOptions: {
header: null
}
},
Login: {
screen: LoginView,
navigationOptions: ({ navigation }) => ({
headerLeft: <Button title='Cancel' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
})
},
ListServerModal: {
screen: ListServerView,
navigationOptions: ({ navigation }) => ({
headerLeft: <Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
})
},
NewServerModal: {
screen: NewServerView,
navigationOptions: ({ navigation }) => ({
headerLeft: <Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
})
}
}, {
initialRouteName: 'Main',
cardStyle: {
backgroundColor: '#fff'
},
mode: 'modal'
});