question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.61.5 → 0.62.0 RCTBridgeModule Error

See original GitHub issue

I upgrade 0.61.5 → 0.62.0 version but getting below error

cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong' NSArray<RCTModuleData *> *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES];

React Native Info:

System:
    OS: macOS 10.15.3
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 63.01 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: 1.15.2 - ~/.yarn/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: Not Found
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.0, 29.0.1, 29.0.2
      System Images: android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.62.0 => 0.62.0 
  npmGlobalPackages:
    *react-native*: Not Found 

This line:

https://github.com/facebook/react-native/blob/6ce3f0a4f7495adb82e655d037dc4e5af462f955/React/CxxBridge/RCTCxxBridge.mm#L778

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:60 (2 by maintainers)

github_iconTop GitHub Comments

352reactions
edrdesignercommented, Feb 15, 2021

This was fixed in the new rn version but if you don’t want to upgrade

Add this post install script to your Podfile:

post_install do |installer|
    ## Fix for XCode 12.5 beta
    find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
    "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
end

End of the Podfile add this function:

def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

After adding this script, just run pod install command.

Happy Coding ❤️

98reactions
devethancommented, Apr 28, 2021

Use patch-packages! I think writing above codes on the Podfile is not sure. Because above solution are the code that simply replace part of codes on the node_modules/react-native. This is not a responsibility of Podfile.

Here’s my solution.

  1. yarn add -D patch-package
  2. Go to node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm and replace _initializeModules:(NSArray<id<RCTBridgeModule>> *)modules to _initializeModules:(NSArray<Class> *)modules
  3. Go to node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm and replace RCTBridgeModuleNameForClass(module)) to RCTBridgeModuleNameForClass(Class(module)))
  4. yarn patch-package react-native
  5. Then a patch file will be created. (Checkout the patch-package)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix upgrade 0.61.5 → 0.62.0 version but getting below error ...
Fix upgrade 0.61.5 → 0.62.0 version but getting below error. This was fixed in the new rn version but if you don't want...
Read more >
分类专栏 - CSDN博客
0.61.5 → 0.62.0 RCTBridgeModule Error #28405 ... Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of ...
Read more >
React Native / iOS SDK. No matching function for call to ...
After that I got a new error which is related to Flipper: ... *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules ...
Read more >
我的代码我的坑(十四) —— Xcode 12.5中React编译不过的 ...
已经有人在github的react-native发过了issue - 0.61.5 → 0.62.0 RCTBridgeModule Error #28405。其实这是 rn 的一个问题,在新版本的 rn 中已经修复 ...
Read more >
Upgrade to React Native 0.62 - Matt Oakes
... helper tool and the diff I will be talking you through is the one between 0.61.5 to 0.62.2. ... this might lead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found