【问题标题】:Ripple effect on TabBarBottomTabBarBottom 上的波纹效果
【发布时间】:2017-10-23 09:39:10
【问题描述】:

如何在 TabBarBottom 中单击选项卡时添加波纹动画。我想要像 Youtube 应用一样的涟漪效果

【问题讨论】:

    标签: react-native react-native-navigation


    【解决方案1】:

    您可以使用Screen's Navigation Options 添加所需样式的tabBarIcon

    tabBarIcon

    给定 { focused: boolean, tintColor: string } 的 React 元素或函数返回 React.Element,以显示在标签栏中

    tabBarLabel

    标签栏或 React Element 中显示的标签的标题字符串或 给定{ focused: boolean, tintColor: string } 的函数返回 React.Element,显示在标签栏中。未定义时,场景标题 用来。要隐藏,参见前面的tabBarOptions.showLabel 部分。

    tabBarOnPress

    回调处理点击事件;参数是被点击的scene: { route, index } 和可以执行的jumpToIndex 方法 为您导航。

    示例

    const MyApp = TabNavigator({
      Home: {
        screen: MyHomeScreen,
        navigationOptions: ({navigation}) => ({
          tabBarIcon: ({focuced, tintColor}) => (
            <MyCustomIcon focuced={focuced} tintColor={tintColor} name="Home" />
          )
        })
      },
      Notifications: {
        screen: MyNotificationsScreen,
        navigationOptions: ({navigation}) => ({
          tabBarIcon: ({focuced, tintColor}) => (
            <MyCustomIcon focuced={focuced} tintColor={tintColor} name="Notifications" />
          )
        })
      },
    });
    

    【讨论】:

    • 我对渲染图标没有任何问题。我想要像gif一样触摸图标时的动画效果
    • @John 这就是为什么你需要添加一个带有波纹效果的自定义图标。
    • 不是一个好的答案。这样你可以给图标添加波纹,但不能将标题+图标作为一个整体添加
    猜你喜欢
    • 2017-05-12
    • 2015-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-01
    • 2011-11-30
    • 1970-01-01
    相关资源
    最近更新 更多