gpt4 book ai didi

react-native - React 导航 headerBackImage 不起作用

转载 作者:行者123 更新时间:2023-12-01 18:03:03 24 4
gpt4 key购买 nike

我在我的 React Native 应用程序中使用 React Navigation 3.11,我想自定义堆栈导航中的后退按钮。在 docs它说:

headerBackImage

React Element or Component to display custom image in header's back button. When a component is used, it receives a number of props when rendered (tintColor, title). Defaults to Image component with react-navigation/views/assets/back-icon.png back image source, which is the default back icon image for the platform (a chevron on iOS and an arrow on Android).

这是我的配置:

let navigationRouteConfigMap : NavigationRouteConfigMap = {
_main:
{screen: page, navigationOptions:
{
[...]
headerBackTitle: '',
headerTruncatedBackTitle: '',
headerBackImage: Images.backArrow,
}
}

}
let stackNavigatorConfig:StackNavigatorConfig = {
headerBackTitleVisible: false
}

return createStackNavigator(navigationRouteConfigMap, stackNavigatorConfig)

我的配置中还有其他页面,所有都具有相同的共享导航选项和自定义标题背面图像。但是,在我的应用程序中,它呈现默认的后退箭头。 (headerBackTitleVisible: false 确实有效)

我做错了什么?

最佳答案

这也有效

headerBackImage: ()=>(<YourAsset />),

关于react-native - React 导航 headerBackImage 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56475891/

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