React native 反应本机导航自定义选项卡栏图标

React native 反应本机导航自定义选项卡栏图标,react-native,react-native-android,react-native-ios,react-native-navigation,React Native,React Native Android,React Native Ios,React Native Navigation,这是否可能有自定义组件按钮或其他替代选项卡栏中简单图标的功能 我需要像这样动态设置我的选项卡栏图标 this.props.navigator.setTabButton({ tabIndex: 0, icon: <Icon name="heart" size={28} /> <--- not appear }); 或者我们只能使用图标?有什么解决办法吗?是的,有可能。我正在分享我的解决方案,代码如下: cons

这是否可能有自定义组件按钮或其他替代选项卡栏中简单图标的功能

我需要像这样动态设置我的选项卡栏图标

this.props.navigator.setTabButton({
          tabIndex: 0,
          icon: <Icon name="heart" size={28} />  <--- not appear    
        });

或者我们只能使用图标?有什么解决办法吗?

是的,有可能。我正在分享我的解决方案,代码如下:

const renderNav=routeName,focused=>{ 回来 {routeName} ; }; const customTabs={navigation}=>{ tabBarIcon:{focused}=>{ const{routeName}=navigation.state; 如果routeName==“主”{ 返回renderNav“家”,聚焦; }如果routeName=='Profile'{ 返回renderNav'Profile',聚焦; }如果routeName=='ProfileOther'{ 返回renderNav'ProfileOther',聚焦; } }, }; const nav=createBottomTabNavigator { 主页:{ 屏幕:主页, }, 简介:{ 屏幕:配置文件, }, 简介其他:{ 屏幕:ProfileOther, }, }, { 默认导航选项:自定义选项卡, animationEnabled:没错, 是的, tabBarPosition:'底部', initialRouteName:“主页”, 选项卡选项:{ showLabel:false, 风格:{ borderTopColor:'透明', 背景颜色:StylesGeneric.COLORS.white, 高度:StylesGeneric.FOOTER\u高度, }, }, }, ;
const AppContainer=createAppContainernav;嘿,你找到解决这个问题的办法了吗?@Rawan,你不能这样做。你能做的就是在路由器上设置图标。谢谢你的尝试!不幸的是,您的代码用于React导航,但我询问了React本机导航@Аццзюцзюццццзюццц。对不起,误会了。