React-native-reanimated 在网络中不起作用

React-native-reanimated not working in web

目前我正在从这个 post 复制示例 https://github.com/software-mansion/react-native-reanimated/issues/537 在网络中尝试时 Reanimated 无法正常工作,而 RN Animated 工作正常。

没有错误或警告。只是动画没有开始。 版本:

"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
"react-native-web": "~0.13.12",
"react-native-reanimated": "~1.13.0",
"expo": "~39.0.2",

也许有人知道如何解决这个问题?

正如@Cris69 在评论中提到的那样,react-native-reanimated 将无法在网络中使用,因为 web 没有桥接. 我发现有两种使用它的方法:

  1. 使用 react-native Animated 用于网络测试并稍后将其交换为重新动画
  2. 用设备或虚拟设备测试一切,或者根本不使用 reanimated

在提出问题时,网络上不支持 Reanimated 但在 Reanimated 的 2+ 版本中,支持网络。

参考 link - https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

根据上面提供的 link 的文档,我能够在网络中使用 Reanimated。