How to clear your project iOS & Android React Native – Tips

When you started to use React Native, sometimes you can see your disk increase a lot, perhaps cache NPM, or simulators cache, mainly if you use a Mac with a limited disk, like me.

Clear NPM cache

npm cache clean --force

Clear Yarn cache

yarn cache clean

Clear the iOS build

To clean the iOS build press Option+Shift+Command+K or go to Xcode menu Product -> Clean Build Folder. This will only clean cache for your current target.

Reset iOS Simulator and erase data

To reset the iOS simulator and erase all simulator data go to menu and Hardware -> Erase All Content and Settings

Reset Android Simulator and erase data

Open Android Studio then goes to menu Tools -> AVD Manager. Then select the menu in your selected simulator and click on wipe data.

Clear Android Build Cache

Go to root directly of your react native project and run following commands:

cd android &&
./gradlew cleanBuildCache