【问题标题】:Transition React Navigation header background colour过渡反应导航标题背景颜色
【发布时间】:2018-06-22 01:24:21
【问题描述】:

我正在使用这个插件进行 React Native 导航:https://reactnavigation.org/

我有两个屏幕,一个是亮的,一个是暗的。第一个屏幕上导航的标题是亮的,在另一个屏幕上它切换到暗。但它会切换标题颜色而没有过渡,这非常难看。是否有任何内置选项或技巧可以让背景颜色切换过渡?

以下是我用于切换颜色的设置: static navigationOptions = ({ navigation }) => ({ title: `Chat with ${navigation.state.params.character.characterName}`, headerTitleStyle: { color: colors.lightGrey }, headerTintColor: colors.lightGrey, headerStyle: { backgroundColor: colors.grey, shadowColor: 'transparent', borderBottomColor: colors.lighterGrey, borderBottomWidth: 0.5 } });

【问题讨论】:

    标签: javascript android ios react-native mobile


    【解决方案1】:

    我认为你最好通过 css 进行转换,只需切换元素的类

        .main-class-for-element{
         transition:background 0.3s linear;
        }
        .light-el{
          background:white;
        }
        .dark-el{
        background:black;
        }
    

    【讨论】:

    • 这是 React Native,不存在 CSS 过渡
    猜你喜欢
    • 2018-06-23
    • 1970-01-01
    • 2015-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-12
    • 2018-01-23
    • 1970-01-01
    相关资源
    最近更新 更多