Quantcast
Viewing all articles
Browse latest Browse all 17073

Integrate react-native version 0.62.2 into existing IOs app error

Following react-native document to integrate react-native to existing IOs app. The structure of directory as document to integrate is

android/ios/   Podfile   #...other ios filenode_modules/  react-native  react  @react-native-community  package.json.... 

So that when run pod install from Podfile can call function use_native_modules

require_relative './libs/react-native-libs/node_modules/@react-native-community/cli-platform-ios/native_modules'...use_native_modules!

But I want to organize the project different due to not change my existing project structure,

so I add react-native-integrate module like as a part of my IOs project like this

my_ios_project  Podfile  libs/     ... other modules     react-native-integrate         node_modules             react-native             @react-native-community             react          package.json

And then I change the path of relative-module:

require_relative './libs/react-native-libs/node_modules/@react-native-community/cli-platform-ios/native_modules'...use_native_module!   

But the problem is in native_modules files and others libraries in node_modules use absolute require. For example in @react-community/cli-platform-ios/native_module.rb there is a line such as

cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('@react-native/cli'))}"

that require absolute path '@react-native-community'. So that when I run Pod install my pod file from parent directory the node can not recognize my children module so that it cause error. Image may be NSFW.
Clik here to view.
enter image description here

As I know the node_module 'spaths list is basically a list of node_modules directories under every directory from the current directory to the root directory. And the current directory is that the directory of the Podfile that call require 'native_module.rb'Could you please give me a solution solve this problem like add node path from children directory or something else ? Thank you.


Viewing all articles
Browse latest Browse all 17073

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>