microsoft / react-native-test-app

react-native-test-app provides an app for all supported platforms as a package
MIT License
596 stars 91 forks source link

Android: Customised application & activity class #2114

Open mo0rti opened 4 months ago

mo0rti commented 4 months ago

I have a react library with some native modules which needs to be initialised within Android Application Class or a Android Activity. Beside initialisation of my own library, I also need to write some extra android code and the best place in within Application class or Host Activity. How can I add those to the test Android app, is there any solution for this?

tido64 commented 3 months ago

We added some event listeners a few years back: https://github.com/microsoft/react-native-test-app/pull/275

There's an example on how to implement them in the linked PR.

The alternative way is to write your own config plugin and modify the classes manually, though I wouldn't recommend it.