Skip to content

Commit

Permalink
Modify ViewManager.receiveCommand to call into delegate (#37070)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37070

This diff fixes an issue where codegened native commands are not able to be triggered, as codegen adds command handling to the delegate. This also brings how receiveCommand is handled into parity with how setProperties is called on the delegate.

Changelog:
[Fixed][Android] - Modify ViewManager.receiveCommand to call into delegate

Reviewed By: javache

Differential Revision: D45236213

fbshipit-source-id: 78f232f288f0a9c5f444e680a9cc49dca1d6af9b
  • Loading branch information
genkikondo authored and facebook-github-bot committed Apr 25, 2023
1 parent 41c6f0f commit 585057d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,7 @@ public synchronized void dispatchCommand(
+ commandId);
}
ViewManager viewManager = resolveViewManager(reactTag);
ViewManagerDelegate delegate = viewManager.getDelegate();
if (delegate != null) {
delegate.receiveCommand(view, commandId, args);
} else {
viewManager.receiveCommand(view, commandId, args);
}
viewManager.receiveCommand(view, commandId, args);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ public void receiveCommand(@NonNull T root, int commandId, @Nullable ReadableArr
* @param commandId code of the command
* @param args optional arguments for the command
*/
public void receiveCommand(@NonNull T root, String commandId, @Nullable ReadableArray args) {}
public void receiveCommand(@NonNull T root, String commandId, @Nullable ReadableArray args) {
final ViewManagerDelegate<T> delegate = getDelegate();
if (delegate != null) {
delegate.receiveCommand(root, commandId, args);
}
}

/**
* Subclasses of {@link ViewManager} that expect to receive commands through {@link
Expand Down

0 comments on commit 585057d

Please sign in to comment.