hel*_*llo 15 react-native react-navigation
我只是将我的本机应用程序升级到 0.62.0,现在我的应用程序不断收到此警告标志
ReactNativeFiberHostComponent: Calling `getNode()` on the ref of an Animated component
is no longer necessary. You can now directly use the ref instead.
This method will be removed in a future release.
Run Code Online (Sandbox Code Playgroud)
我不确定为什么会出现这个问题?有人可以解释一下吗?
我也看到堆栈
ref.getNode |
createAnimatedComponent.js:129:20
SafeView#_updateMeasurements | index.js:192:14
SafeView#componentDidUpdate | index.js:154:9
Run Code Online (Sandbox Code Playgroud)
更新
我相信这可能来自 react-navigation 的 SafeAreaView
在升级 ro RN 0.62.1 后,我也遇到了这个警告,我根本没有使用getNode()
,原来它来自我使用的依赖项,react-native-snap-carousel
因为他们使用 FlatList 构建它并且可能使用了getNode()
它。
现在在他们的 GitHub 存储库中有一个关于此的未决问题,我们可以关注,这是该问题的链接
这也来自包react-native-safe-area-view
,可能你的应用程序正在使用这个包,现在他们发布了新版本来修复getNode()
弃用,请参阅此 PR
所以不要直接自己修复文件,你只需要更新包,只需运行: npm i react-native-safe-area-view
希望这有帮助:)
小智 6
在第 192 行更改
this.view.getNode().measureInWindow((winX, winY, winWidth, winHeight)
到
this.view.measureInWindow((winX, winY, winWidth, winHeight)
归档时间: |
|
查看次数: |
10395 次 |
最近记录: |