RCTBatchedBridge已弃用,将在未来的React Native版本中删除
我在我的反应Native App中面临这个警告,如何解决这个问题任何建议都会有所帮助。
我的现有原生应用程序遇到了同样的问题。 我按照“ 与现有应用程序集成”指南进行了解决。
只需更改Podfile
target 'MyApp' do pod 'React', :path => '../node_modules/react-native', :subspecs => [ ... 'BatchedBridge' ] end
至
target 'MyApp' do pod 'React', :path => '../node_modules/react-native', :subspecs => [ ... 'CxxBridge' ] # Third party deps podspec link pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' end
我想理想的方法是重构使用RCTBatchedBridge的模块以避免警告,但是如果这是你无法控制的,你可以用console.ignoredYellowBox
隐藏它:
console.ignoredYellowBox = ["RCTBatchedBridge is deprecated and will be removed in a future React Native release."];
您可以在以下url阅读更多相关信息: https : //facebook.github.io/react-native/docs/debugging.html#warnings