No se puede inicializar un parámetro de tipo 'NSArray<id<RCTBridgeModule>> *' con un rvalue de tipo 'NSArr

Se produjo la siguiente excepción al compilar un proyecto RN antiguo

Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class> *'

configuración de enfermera registrada

"dependencies": {
    "@react-native-community/async-storage": "^1.8.1",
    "@react-native-community/masked-view": "^0.1.7",
    "@react-native-community/viewpager": "^4.0.0",
    "@react-navigation/bottom-tabs": "^5.1.1",
    "@react-navigation/drawer": "^5.1.1",
    "@react-navigation/native": "^5.0.9",
    "@react-navigation/stack": "^5.1.1",
    "@types/react-dom": "^16.9.6",
    "@yz1311/react-native-signature-pad": "^0.1.5",
    "decimal.js": "^10.3.1",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-actionsheet": "^2.4.2",
    "react-native-easy-grid": "^0.2.2",
    "react-native-easy-table": "^1.0.2",
    "react-native-elements": "^1.2.7",
    "react-native-fit-image": "^1.5.5",
    "react-native-gesture-handler": "^1.6.0",
    "react-native-image-picker": "^2.3.3",
    "react-native-keyboard-manager": "^4.0.13-16",
    "react-native-photo-browser": "^0.6.0",
    "react-native-render-html": "^4.2.3",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.2.0",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-table-component": "^1.2.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.1.2",
    "rn-fetch-blob": "^0.12.0",
    "rxjs": "latest",
    "rxjs-hooks": "^0.6.2",
    "teaset": "^0.7.4"
  },

Solución

Agregue el siguiente código al Podfile del proyecto iOS e intente instalar el pod nuevamente

post_install do |installer|
## Fix for XCode 12.5
  find_and_replace(
  "../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
  "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules",
  "_initializeModules:(NSArray<Class> *)modules")
 
  find_and_replace(
  "../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
  "RCTBridgeModuleNameForClass(module))",
  "RCTBridgeModuleNameForClass(Class(module)))"
  )
end
 
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

Lo anterior es todo el contenido compartido esta vez, ¡espero que pueda ser de ayuda para todos!

Acho que você gosta

Origin blog.csdn.net/survivorsfyh/article/details/130149092
Recomendado
Clasificación