Skip to content

[Android] No API for updating props on android root component #6303

@jaredly

Description

@jaredly

In iOS, you can do rctRootView.appProperties = newProps, and it will update the root view with new props. On android it doesn't seem to be implemented.

This behavior is critical for my use case of incrementally adopting react native in a large android app.

I think I want a function like ReactRootView.updateProps(Bundle props) that would look something like

public void updateProps(Bundle newProps) {
  WritableNativeMap appParams = new WritableNativeMap();
  Double rootTag = MagicallyGetTheRootTag() // <- the rootTag isn't actually stored anywhere at the moment
  appParams.putDouble("rootTag", rootTag);
  appParams.putMap("initialProps", newProps);
  final CatalystInstance catalystInstance = mReactInstanceManager.getCurrentReactContext().getCatalystInstance();
  String jsAppModuleName = this.getJSModuleName();
  catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
}

based on the startReactApplication fn

Before I made a PR I wanted to check my direction -- does it look reasonable? I think I'll have to store the rootTag on the ReactRootView instance, b/c I can't find anywhere else that it's already stored.

Metadata

Metadata

Assignees

Labels

Resolution: LockedThis issue was locked by the bot.Type: EnhancementA new feature or enhancement of an existing feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions