React-navigation tabbar中间较大的图标

Mar*_*ood 7 react-native react-native-navigation react-navigation

如果已在其他地方得到解答,请随时指出我正确的方向,但我无法通过此处或谷歌找到它.也许我只是不知道这个正确的名字?

我目前正在使用React-navigation(反应原生),我想知道是否可以在标签栏的中心制作一个比其他图标更大的图标,特别是当页面滚动时背后的透明度.

这里以模拟为例: 中间较大的图标覆盖屏幕的可滚动区域

有没有人可以使用这个库,以及如何实现它?

一旦他们实际发布了一个没有破坏的版本,错误的,实际上带有准确的文档,并且没有被当前版本的react-native打破,我也在考虑试用Wix库react-native-navigation.(现在它有点像灾难区域,但它看起来非常好,所以我很想尝试它再次实际工作),所以它可能与他们的库,我只需要等待尝试它出来吗?

小智 3

我能够使用以下配置创建类似的样式:

export const Tabs = TabNavigator({
  Profile: {
    screen: ProfileStack,
    navigationOptions: {
      title: 'Profile',
      tabBarLabel: 'Profile',
      tabBarIcon: ({tintColor}) => <Icon name="ios-settings-outline" 
      type="ionicon" size={33} color={tintColor}/>
    }
  },
  Charities: {
    screen: Charities,
    navigationOptions: {
      title: 'Browse',
      tabBarLabel: 'Browse',
      tabBarIcon: ({tintColor}) => 
      <View style={{
          height: 80,
          width: 80,
          borderRadius: 100,
          backgroundColor: '#FE6D64',
          paddingTop: 15}}>
        <Icon name="ios-heart-outline" type="ionicon" size={45} 
         color{tintColor}/>
      </View>
    }
  },
  Account: {
    screen: AccountStack,
    navigationOptions: {
      title: 'Account',
      tabBarLabel: 'Account',
      tabBarIcon: ({tintColor}) => <Icon name="connectdevelop" type="font-
      awesome" size={25} color={tintColor}/>
    }
  }
}, {
  tabBarOptions: {
    activeTintColor: '#84E1BF',
    inactiveTintColor: 'white',
    labelStyle: {
      fontSize: 12
    },
    style: {
      backgroundColor: '#283940'
    },
    showLabel: false
  }
});
Run Code Online (Sandbox Code Playgroud)

Charities 选项卡延伸到选项卡栏之外,因为 tabBarIcon 包装在高度大于选项卡栏的 View 组件中。然后使用 borderRadius:100 制作圆形形状。

可能有更好的方法来做到这一点,但这非常简单。

标签栏图像

  • 你是如何设法使组件溢出的?我尝试了您的自定义组件,但它没有溢出 (2认同)