import React, {Component} from 'react';
import {Text, TouchableOpacity, View, StatusBar} from 'react-native';
import {StackNavigator} from 'react-navigation';
import Icon from 'react-native-vector-icons/MaterialIcons';
import styles from "../styles/Style";
class ProfileScreen extends Component {
static navigationOptions = ({navigation}) => {
return {
headerLeft: (
<TouchableOpacity onPress={() => {
navigation.navigate('DrawerOpen');
}}>
<Icon name="menu" size={30} color="#fff" style={styles.burgerIcon}/>
</TouchableOpacity>
),
title: 'My Profile',
headerRight: (
<Icon name={'edit'} size={30} color={'#fff'} style={styles.headerRightIcon}/>
),
headerTintColor: "#fff",
headerStyle: {
backgroundColor: '#8BC83D',
height: 56,
elevation: null
}
};
};
render() {
return (
<View style={styles.screenContainer}>
<StatusBar
backgroundColor="#7CB236"
barStyle="light-content"
/>
<Text style={styles.welcome}>
I amsecond reder
</Text>
</View>
);
}
}
const ProfileScreenList = StackNavigator(
{
ProfileScreenIndex: {screen: ProfileScreen},
}
);
export default ProfileScreenList
我也試過,但它有沒有效果。但是我不確定我應該把這個放在哪裏。 – Arnaud
在您的頂級根組件或頂級「視圖」上。結帳[這個答案](https://stackoverflow.com/a/39300715/2054072)也可以幫助,如果你想要它在兩個平臺上。 –
謝謝! (賞金可以明天頒發)。對於讀者來說:如果你使用NativeBase,這不起作用。請參閱此頁面以獲取解決方案:https://github.com/GeekyAnts/NativeBase/issues/323 – Arnaud