You can change the name attribute in package.json, run react-native upgrade, and just let react overwrite the android/ios files. Don't overwrite your index files if there is unsaved code, however.
If you are using vs code, then it is much easier and works really fine.
1)Open your project in vs code, goto search tab.There are two text inputs, first takes the input which you want to search in all the files in your project (some files and directories are excluded and you can manage them in settings, but that is not needed). The other text input takes the input with which you want to replace the first input in all the files (in simple words, change all occurences).
In the first input field, search for com.<your_package_name>. This is the older name of your project (current name of project which you want to change).
In the second input field, enter com.<new_package_name> and press the replace button (small icon button on the right side of 2nd input field). It will replace all the occurences of the older package name thus renaming the project.
{Repeat the above two steps with <your_package_name> only too}
Now goto android>app>src>main>java>com>older_package_name .Rename the older_package_name to the new package name and you are done.
cd android && ./gradlew clean && cd ...
And you are done. Run npx react-native run-android to test the app.