【问题标题】:Inactive tab opacity (materialTopTabnavigator)非活动选项卡不透明度(materialTopTabnavigator)
【发布时间】:2019-05-21 14:17:57
【问题描述】:

我已经完成了 TopTabNavigator,并在 One 选项卡上设置了背景。 我想知道如何在此选项卡处于非活动状态时移除不透明度。

无论是否集中,我都尝试使用相同的backgroundColor 执行条件。

谁能指导我如何解决这个问题?

 tabBarLabel: ({focused}) => (
  focused ? 
  <View 
  style={{backgroundColor:'#FF6D70', height: 30, width: 60, justifyContent: 'center', 
  borderBottomLeftRadius: 10, borderBottomRightRadius: 10, marginLeft: 1}}>
    <Text style={{color:'white', fontSize: 10, textAlign: 'center'}}>dashboard</Text>
  </View> : 
    <View 
    style={{backgroundColor:'#FF6D70', height: 30, width: 60, justifyContent: 'center', 
    borderBottomLeftRadius: 10, borderBottomRightRadius: 10, marginLeft: 1}}>
      <Text style={{color:'white', fontSize: 10, textAlign: 'center'}}>dashboard</Text>
    </View> ),

【问题讨论】:

  • 您找到解决方案了吗?

标签: reactjs tabs focus native opacity


【解决方案1】:

检查此React NavigationtabBarOptions 下有一个名为pressOpacity 的属性。希望对您有所帮助。

createMaterialTopTabNavigator({ /** Screens */ }, {
  tabBarOptions:{
     pressOpacity: 1 // Some value for pressed tab
     ... // Other Options
  }
  ... // Other Options
});

【讨论】:

  • 您好,感谢您的帮助,但这并不是我真正需要的。让我给你看截图。这就是我启动我的应用程序时所拥有的,我希望粉红色按钮在不活动时保持粉红色而不透明。 !ImgurImgur
猜你喜欢
  • 2014-01-10
  • 1970-01-01
  • 1970-01-01
  • 2012-12-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-19
  • 1970-01-01
相关资源
最近更新 更多