Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use multiple ReactActivity with seperate js bundle?

Tags:

react-native

How can I jump from one ReactActivity to another, each with a seperate js bundle? MainActivty -> index.android.js SettingActivity -> setting.android.js

I have read many Android examples using React-Native. Unfortunately, all of them are single activity.

like image 256
Wei Chen Avatar asked Jun 20 '26 11:06

Wei Chen


1 Answers

You can implement multiple activities that extend ReactActivity, and override the getMainComponentName method to the name of a root level component that you wish to use, such as the component defined in your setting.android.js

Make sure to register your component in AppRegistry.

If you wish to launch another activity, I've found it's easiest to launch the activity using Linking (https://facebook.github.io/react-native/docs/linking.html) to fire an intent for an app url, and add the app url intent-filter to the activity in AndroidManifest.xml.

like image 129
munkay Avatar answered Jun 22 '26 22:06

munkay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!