Display Android Native Activity Into React Native View
I have a DemoApp Android App which have a SampleActivity.java and I want to display it inside and React Native View. I have created a React Native Component, it loads fine, what I
Solution 1:
Well you can't show an activity as a View.
Activities are not views. Each app can have only one activity in started stated at a time. If you want to load a Ui process as a View while it has lifecycles, Fragment is for you. Fragments are able to be represented as a view component in the Ui hierarchy.
Solution 2:
After some research I saw that the React Native 0.66
version added docss about the use of Native Fragments.
Here you are the docs with an example: https://reactnative.dev/docs/native-components-android#1-create-a-fragment
I've followed the steps from the docs and converted the Activity into a Fragment and this solved my issue.
Post a Comment for "Display Android Native Activity Into React Native View"