如何在React-Navigation StackNavigator中为动态headerStyle设置动画?

时间:2020-07-14 04:58:18

标签: react-native react-navigation

我的应用程序中有一个全局主题系统设置,并且我希望能够在主题更改时对backgroundColor进行动画处理,例如,如果我在一个屏幕中返回到另一个主题屏幕,则我希望标题使用新的backgroundColor在瞬息万变的INSTEAD中淡入淡出。这会使它感觉更平滑。

const MainStack = ({ theme }) => {
  return (
    <Stack.Navigator
      screenOptions={{
        headerStyle: {
          backgroundColor: theme.featureColor,
        },
        headerTitleStyle: { color: theme.text },
        headerBackTitleStyle: { color: theme.text },
        headerTintColor: theme.text,
      }}>

如果更改主题,此刻它会立即更改,但是,如果可能的话,我想淡化backgroundColor。

有什么建议吗?

0 个答案:

没有答案