Add the following scripts to package.json
:
"clean": "npm run clean:git && npm run clean:npm && npm run clean:tmp && npm run clean:android && npm run clean:ios",
"clean:android": "cd android && rimraf .gradle build && (./gradlew clean --continue || true) && cd ..",
"clean:git": "git clean -fdX",
"clean:ios": "cd ios && xcodebuild clean -quiet && rimraf Pods && pod cache clean && pod deintegrate && cd ..",
"clean:npm": "rimraf node_modules && npm cache clean --force",
"clean:tmp": "watchman watch-del-all && rimraf '$TMPDIR/react-native-packager-cache-*' && rm -fr '$TMPDIR/metro-cache' && rm -fr '$TMPDIR/haste-map-*'"
Then run npm run clean
to perform a deep clean on your React Native project.
or
npx react-native-clean-project
fyi: react-native-clean-project