Skip to content Skip to sidebar Skip to footer

Load Fragment In A React Native App

I'm developing a bridge between an Android library of mine and ReactNative, to be able to use my library also on hybrid apps. I first created a basic app with react-native init whi

Solution 1:

You can add your own container to the existing layout. For example:

window.decorView.findViewById<ViewGroup>(android.R.id.content)
            .addView(
                    FrameLayout(this).apply {
                        id = R.id.fragment_container
                        layoutParams = FrameLayout.LayoutParams(
                                FrameLayout.LayoutParams.MATCH_PARENT,
                                FrameLayout.LayoutParams.MATCH_PARENT
                        )
                    }
            )

Now you can add your fragment to this container. Also this library might be helpful - https://github.com/hudl/react-native-android-fragment

Post a Comment for "Load Fragment In A React Native App"