Skip to content

[Android] ReactRootView layout configuration inside native app #13476

@ahetawal-p

Description

@ahetawal-p

Trying to add a ReactRootView to my existing layout which looks like this

ReactRootView contentView = new ReactRootView(context);
LinearLayout container = (LinearLayout) parent.findViewById(R.id.view_container);
contentView.startReactApplication(reactInstanceManager, "MyComponent", null)
container.addView(contentView, -1, new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));

With the above setup, my reactview never gets rendered, since the height is always 0.
I have to explicitly provide the height to my layout as -

container.addView(contentView, -1, new LinearLayout.LayoutParams(MATCH_PARENT, 200));

How does ReactRootView handles the layout params when embedded inside a android native app ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions