Improve header buttons for Android
This commit is contained in:
parent
6781b3052d
commit
b38c072f51
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button } from 'react-native';
|
import { Button, Platform } from 'react-native';
|
||||||
import { StackNavigator } from 'react-navigation';
|
import { StackNavigator } from 'react-navigation';
|
||||||
import LoginView from './views/login';
|
import LoginView from './views/login';
|
||||||
import NewServerView from './views/serverNew';
|
import NewServerView from './views/serverNew';
|
||||||
|
@ -8,11 +8,13 @@ import RoomsListView from './views/roomsList';
|
||||||
import RoomView from './views/room';
|
import RoomView from './views/room';
|
||||||
|
|
||||||
|
|
||||||
|
const position = Platform.OS === 'ios' ? 'headerLeft' : 'headerRight';
|
||||||
|
|
||||||
const MainCardNavigator = StackNavigator({
|
const MainCardNavigator = StackNavigator({
|
||||||
Rooms: {
|
Rooms: {
|
||||||
screen: RoomsListView,
|
screen: RoomsListView,
|
||||||
navigationOptions: ({ navigation }) => ({
|
navigationOptions: ({ navigation }) => ({
|
||||||
headerLeft: <Button title='Servers' onPress={() => navigation.navigate('ListServerModal')} />
|
[position]: <Button title='Servers' onPress={() => navigation.navigate('ListServerModal')} />
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Room: {
|
Room: {
|
||||||
|
@ -38,19 +40,19 @@ export default new StackNavigator({
|
||||||
Login: {
|
Login: {
|
||||||
screen: LoginView,
|
screen: LoginView,
|
||||||
navigationOptions: ({ navigation }) => ({
|
navigationOptions: ({ navigation }) => ({
|
||||||
headerLeft: <Button title='Cancel' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
|
headerLeft: Platform.OS === 'ios' && (<Button title='Cancel' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
ListServerModal: {
|
ListServerModal: {
|
||||||
screen: ListServerView,
|
screen: ListServerView,
|
||||||
navigationOptions: ({ navigation }) => ({
|
navigationOptions: ({ navigation }) => ({
|
||||||
headerLeft: <Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
|
headerLeft: Platform.OS === 'ios' && (<Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
NewServerModal: {
|
NewServerModal: {
|
||||||
screen: NewServerView,
|
screen: NewServerView,
|
||||||
navigationOptions: ({ navigation }) => ({
|
navigationOptions: ({ navigation }) => ({
|
||||||
headerLeft: <Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />
|
headerLeft: Platform.OS === 'ios' && (<Button title='Close' onPress={() => navigation.dispatch({ type: 'Navigation/BACK' })} />)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Reference in New Issue