External Component
The ExternalComponent layout allows you to display any native view as a screen. To use the External Component we'll need to register it with a string name. This name is then used when declaring layouts in JS.
Android#
Implementing the native component#
When it comes to implementing an external component on Android, you have two choices. We recommend you use a base class extending View. If you're required to use Fragments, you'll find an basic example below.
ViewGroup#
Fragment#
Using a Fragment as an external component is done by attaching the Fragment to a FrameLayout, and returning the FrameLayout from the asView() method of the ExternalComponent.
Registering the component#
iOS#
ViewController registration#
Using the component from JS#
Once you've registered the external component in native, you can use it in your layout declarations. For example, to show an external component modally:
caution
props passed to external components are sent over the bridge and therefore must be serializable.