RCTBatchedBridge已弃用,将在未来的React Native版本中删除

时间:2017-11-16 11:38:12

标签: ios react-native

我在我的反应Native App中面临这个警告,如何解决这个问题任何建议都会有所帮助。

2 个答案:

答案 0 :(得分:7)

我的现有原生应用也遇到了同样的问题。我按照Integrating with Existing Apps指南解决了问题。

只需更改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

答案 1 :(得分:1)

我想理想的方法是重构使用RCTBatchedBridge的模块来避免警告,但如果这不受你的控制,你可以用console.ignoredYellowBox隐藏它:

console.ignoredYellowBox = ["RCTBatchedBridge is deprecated and will be removed in a future React Native release."];

您可以在https://facebook.github.io/react-native/docs/debugging.html#warnings

了解更多相关信息