I am new to React-Native, I have an objective of creating React-Native based components that can be used in other Android native Apps . However, we would to export this react native component as an Android library (.aar) and then distribute to other consumers.
I have seen this question has been asked couple of times in SOF, however do not see a clear answer, hence Im posting again.
Open the package. json file and under name — change react-native-native-toast-library to react-native-native-toast-library-XXXX, where XXXX is your unique part. If you don't have an npm account create it [here]. Open the terminal in the project directory, and type npm adduser and then your username details.
In the following project, their goal was to add react-native dependencies to a vanilla Android app:
https://github.com/glung/react-native-as-an-android-lib
They note some drawbacks that the user of the Android library will face:
React-native requires the application to implement the ReactApplication interface to run. This means that the app needs to add a dependency to 'com.facebook.react:react-native`.
Final APK size will be bigger. There is not much we can do about that since about 6M comes from react-native ndk libraries (compiled for arm64-v8a, armeabi, armeabi-v7a x86 , x86_64).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With