I'm trying to fix an issue in React Native, I forked the RN repo, added some code to some java files, and run the rn-tester App, my fix was working fine on the rn-tester App, but when adding this fix to a react-native
package inside node_modules
directory and patching it using patch-package
, my fix not working even if I deleted the node_modules
and installed them again, I see my code inside react-native
java files but it have no effect on the App.
Also, any Log.d
or System.out.println
messages appear on the rn-tester App but don't appear on the other App.
- added some code to
/node_modules/react-native/ReactAndroid/.../somefiles.java
that fixed an RN issue on the rn-tester App. - run
npx patch-package react-native
and insidepackage.json
file under scripts added"postinstall": "npx patch-package"
. - deleted
node_modules
and runnpm i
. - checked
/node_modules/react-native/ReactAndroid/.../somefiles.java
and my code existed. - run
npm run android
. - The RN issue still exists.
Expected
The code fixed the issue on the rn-tester App
so it should fix it on the other App.
Because Rect Native takes its Java dependency as an AAR archive any changes to node modules will be skipped. You need to build react native from source as described here: https://reactnative.dev/contributing/how-to-build-from-source