gpt4 book ai didi

react-native - 如何在React Native上隐藏createStackNavigator的 header ?

转载 作者:行者123 更新时间:2023-12-04 02:47:28 26 4
gpt4 key购买 nike

我想隐藏标题,因为我已经在代码中设置了工具栏样式:

import {createStackNavigator}
from 'react-navigation'
const AppStackNavigator = createStackNavigator ({
Home: HomePage,
Friend: AddFriend,
Bill: AddBill,
})
class App extends Component {
render() {
return (
<AppStackNavigator initialRouteName='Home'/>`<br>
);
}
}
export default App;


我应该在代码中添加什么?

最佳答案

像这样更新您的代码

const AppStackNavigator = createStackNavigator ({
Home: {
screen: HomePage,
navigationOptions: {
header: null,
},
},
})


如果您不想要所有屏幕的标题,则

const AppStackNavigator = createStackNavigator ({
Home: {
screen: HomePage,
},
},
{
navigationOptions: {
header: null,
},
})


注意:此解决方案适用于旧版本的React Navigation。

关于react-native - 如何在React Native上隐藏createStackNavigator的 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51129444/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com