static navigationOptions = ({ navigation }) => ({
headerStyle: [{
borderBottomWidth: 1,
borderBottomColor: "#eee",
elevation: 0,
}, Platform.OS == "android" && {
paddingTop: StatusBar.currentHeight,
height: StatusBar.currentHeight + 56,
}],
headerTitle: <Text style={{ fontSize: 18, fontWeight: "bold", color: "#333" }}>我的錢包</Text>,
headerLeft: (
<TouchableOpacity
style={{ padding: 13 }}
onPress={() => navigation.goBack()}
>
<Image style={{ width: 9, height: 16 }} source={require("../assets/images/icon-back.png")} />
</TouchableOpacity>
),
headerRight: (
<TouchableOpacity
style={{ padding: 13 }}
onPress={() => navigation.goBack()}
>
<Text style={{ color: "#333", fontSize: 16, fontWeight: "500" }}>明細</Text>
</TouchableOpacity>
)
})
如果個別頁面不想使用這個標題
在創(chuàng)建路由導航的createStackNavigator函數(shù)傳入 navigationOptions: { header: null }
取消全部標題欄則在createStackNavigator函數(shù)的第二個參數(shù)對象中加入 headerMode: 'none'

image.png