Clean react native project

How to clean react native project?

Is there any way to clean react native project as we can clean xcode project?

Any help will be appreciated!


Solution 1:

A react-native Project is about one XCode Project and one Android Project. (for pure js code, there's no need to do clean)

So, what you need would be

Clean XCode Project with

cd ios
xcodebuild clean

And then clean Android Project with

cd android
./gradlew clean

You can simply write a batch file for it.

Solution 2:

For android project

cd android &&./gradlew clean && cd ../

For iOS project

cd ios && xcodebuild clean && cd ../

If you need build clean again and again then add this scripts in the package.json file like this

scripts: { 
  "clean:android": "cd android && ./gradlew clean && cd ../",
  "clean:ios": "cd ios && xcodebuild clean && cd ../", 
}

Then run for android

yarn clean:android

And run for iOS

yarn clean:ios