Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to Integrate react-native to iOS with separate folders. (Not inside react root directory).?

$
0
0

I already have a project on iOS and Android. I would like to implement some new features in react-native. I have done integration in sample apps as well and its working like a charm.

But my doubt is, this is working when I have iOS and Android code in react root directory. when I move the iOS and Android in a separate folder unable to install pod in ios. Getting error in "use_native_modules".

Working Folder Structure

working_folder_structure

But I need

Expecting_folder_structure

I have changed the path in Podfile pointing to the react directory. When I use

require_relative '../ReactNative/node_modules/@react-native-community/cli-platform-ios/native_modulesuse_native_modules!

I am unable to install the pods. getting

[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}internal/modules/cjs/loader.js:1032 throw err; ^Error: Cannot find module 'react-native/cli'Require stack:- /Users/user/Documents/Sample ReactNative Projects/SeperateFolders/iOS/[eval]    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)    at Function.Module._load (internal/modules/cjs/loader.js:898:27)    at Module.require (internal/modules/cjs/loader.js:1089:19)    at require (internal/modules/cjs/helpers.js:73:18)    at [eval]:1:87    at Script.runInThisContext (vm.js:131:18)    at Object.runInThisContext (vm.js:295:38)    at Object.<anonymous> ([eval]-wrapper:10:26)    at Module._compile (internal/modules/cjs/loader.js:1200:30)    at evalScript (internal/process/execution.js:98:25) {  code: 'MODULE_NOT_FOUND',  requireStack: ['/Users/user/Documents/Sample ReactNative Projects/SeperateFolders/iOS/[eval]'  ]}. #  from /Users/user/Documents/Sample ReactNative Projects/SeperateFolders/iOS/Podfile:48 #  ------------------------------------------- #    >    use_native_modules! #     #  -------------------------------------------

Also when I comment those 2 lines in pod file auto-linked pods are not getting installed.Is there any way to achieve this?or Is this the structure we need to follow?

Kindly help.

Thanks in advance.


Viewing all articles
Browse latest Browse all 16750

Trending Articles



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