I know it might be very basic question. But I am very new and got a codebase with only android support. I need to add iOS for it. Please help me
-
I hope this answer will help you. Please check this [answer](https://stackoverflow.com/questions/42506068/how-can-i-regenerate-ios-folder-in-react-native-project/42507293#42507293) – Rajan Mar 31 '20 at 13:18
-
Can you add the projects' `package.json` file? – Christos Lytras Apr 01 '20 at 09:15
2 Answers
As you're aiming to build a cross-platform app, React Native provides two ways to organize the code and seperate it by platform: platform module or platform-specific file extensions.
As you already have an Android app, I assume it has more complexity so you might want to split the code out into separate files.
You say you have an Android app but i don't thing that at any point you specified that the app should only build for Android (you can review in the package and the project configuration). So, the following command should be enough:
react-native run-ios

- 14,289
- 18
- 86
- 145
If you created your react native app from a template (e.g. using npx react-native init ProjectName
), it already provides an ios
and android
folder, so it already supports it. If the file is not there, you could follow the instructions that @Rajan shared above to recreate the ios folder.
If your problem is running the iOS application using npm run ios
, and its failing to build or the javascript throws an error, the quickest thing to try is cd ios
, then pod install
. If this does not work, it might be because you have additional dependencies you have installed, which require specific instructions and configuration to be done in the ios folder. This is library dependent, if needed, will be explained in depth in the README.md
of the library. For example, react-native-firebase
has a lot of steps, and is different to the android configuration.
Sometimes it is helpful to modify these configurations in XCode instead of editing the files manually (e.g. plist, xml, xproj). You can open xcode quickly using xed ios
when in the root project folder.
Note: As usual, remember to have the libraries available in the node_modules folder, npm install
.
In the future, you might choose to run different javascript code based on the platform (platform-specific code). React native allows that by using file.android.js
and file.ios.js
. However, your IDE is likely to struggle with the 2 files, and won't be as helpful compared to file.js
. Alternatively, you can import Platform
and conditionally check at runtime, what your platform is.
If you used Expo, you don't have access to the native code, but will already support iOS.

- 22,056
- 10
- 114
- 167