Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Android instant app in React Native?

It seems like there isn't any examples, tutorials or guides on the internet for creating Android instant app with react native.

I have an existing react native app and I want to create an Android instant app. The existing app that was created in react native resides in the directory app, and the instant app I created natively resides in the directory instantapp. I can run this instantapp as an instant app in Android Studio, and all it does is to show a text "Hello instant app" on a blank screen.

I can write Android native code to add more ui and features to this instantapp natively, but I would like to do that in react native and using javascript instead of writing native Android code. How can I do that?

like image 355
s-hunter Avatar asked Aug 07 '21 03:08

s-hunter


2 Answers

I would look at Integration with Existing Apps, My bet would be you need to create what is essentially another react native app with a separate AppRegistry call. and then integrate the ReactRootView into the instant app.

I might totally be wrong here. But this is what I would try...Please post if your successful. I would love to try this in one of my apps.

like image 190
Walker Frederick Avatar answered Sep 27 '22 21:09

Walker Frederick


Creating a new react native app with the same package name, then configure the android manifest and gradle file for instant app. Although it's a new codebase, but this worked.

like image 33
s-hunter Avatar answered Sep 27 '22 21:09

s-hunter