So a while ago I deleted the /ios directory in my react native app (let's call it X). I've been developing and testing using the android emulator but now I'd like to make sure it works on ios with xcode simulator etc.
So my current idea is to create a new react native bare project (let's call it Y) with ios folder, then follow these steps to rename Y so that it has the name of X and then moving the /ios directory from Y into X and trying to run-ios
.
I'll update here how that goes, but I wondered if there is a better way and has nobody been in this situation before?
I've googled lots of things 'regenerate ios folder' 'deleted ios folder' 'add ios folder to existing..' and nothing helpful. Maybe my googlefu isn't good enough but if anyone has any suggestions, much appreciated.
Step 2 will be making sure it compiles because of dependencies and stuff but for now my goal is to just get the /ios folder back in the project and for React Native to be aware of it's existence (it has all the necessary config).
Thanks
To clean the iOS build press Option+Shift+Command+K or go to Xcode menu Product -> Clean Build Folder.
Running your React Native application Install the Expo Go app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo Go app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the default iOS Camera app.
The process you need to follow is so similar to renaming a react native app. Basically you just need to run react-native upgrade
in your root project directory. For further info you can check another question here. The instructions below explains how to create another react native project based on a copied one with a new name.
index.ios/android.js
file which is given as a parameter to AppRegistry.package.json
/ios
and /android
folders which are remaining from your older app.$react-native upgrade
to generate /ios
and /android
folders again.$react-native link
for any native dependency.$react-native run-ios
or anything you want.Simply remove/delete android and ios (keep backup android and ios folder) and run following command:
react-native eject Supported version : react-native <= 0.59.10 react-native-cli <= 1.3.0 react-native upgrade --legacy true Supported version : react-native >= 0.60.0 react-native-cli >= 2.1.0
Ref : link
Edited(March 2021)
npm i react-native-eject npm i @react-native-community/cli react-native eject
will generate the both android and ios folder.
Ref.: link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With