I want to start again building my React Native app with iOS because I messed up the XCode Project and can't make it build. How can I just reinitialize the iOS project or in other cases the Android Project in my existing React Native app?
It seems that this functionality was once implemented in react-native with the command react-native ios or react-native android, which are no longer implemented.
But I found a solution for Android here which is also working for iOS:
const fs = require('fs');
const generate = require('react-native/local-cli/generate/generate.js');
generate([
'--platform', 'ios', //or android
'--project-path', process.cwd(),
'--project-name', JSON.parse(
fs.readFileSync('package.json', 'utf8')
).name,
]);
Credit
Just put this code in a script and run it with node script-name.js
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