0

我有一个react-native应用程序并react-native-reanimated从 V1 更新到 V2。从那以后,我遇到了一个错误interpolate is not a function,这是由于react-navigation-drawer尝试使用interpolate其旧结构而不是interpolateNode.

我无法降级react-native-reanimated到 V1,因为它会导致构建错误。

我的“解决方案”是修补react-navigation-drawer我的应用程序中的库以使用interpolateNode(in Drawer.jsand Drawer.tsx),但现在每次使用导航时都会出现以下错误:

来自 js 的格式错误的调用

在调试器中:

不变违反 - 值 NaN

Drawer.tsx中,函数interpolateNodecond用于设置 和 的opacity样式zIndex。两者都在 throw Type 'AnimatedNode<number>' is not assignable to type 'number',所以我想这些函数不能再以这种方式用于设置样式了——也许这是我得到这个 NaN 错误的部分原因:

<Animated.View
    style={[
    styles.overlay,
    {
        opacity: interpolateNode(this.progress, {
        inputRange: [PROGRESS_EPSILON, 1],
        outputRange: [0, 1],
        }),
        zIndex: cond(
        greaterThan(this.progress, PROGRESS_EPSILON),
        0,
        -1
        ),
    },
    overlayStyle,
    ]}
/>

我觉得通过尝试在库中进行更改,我正朝着错误的方向前进,此时我不知道如何让我的应用程序停止崩溃。

有没有人知道如何解决这个问题,或者谁能指出我正确的方向?

版本:

  • 注册护士:0.64.2
  • 反应原生动画:2.2.2
  • 反应导航抽屉:2.7.1

谢谢!

4

0 回答 0