Skip to content

Commit

Permalink
fix: Add deprecated receiveCommand method (#601)
Browse files Browse the repository at this point in the history
Support deprecated receiveCommand which receives commandId as int.

It may be RN bug and also dependent on RN version, but running on RN 0.76.2 (old arch), the `receiveCommand` which accepts `String commandId` is never called, therefore calling `focus()` and `blur()` functions does nothing. Here we manually delegate this call using the deprecated `receiveCommand`. JS sends the command id as Int.
  • Loading branch information
CptFabulouso authored Nov 26, 2024
1 parent 6fbcf6e commit 0d00e13
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ protected void addEventEmitters(
picker.setOnFocusListener(eventEmitter);
}

@Override
public void receiveCommand(@NonNull ReactPicker root, int commandId, @androidx.annotation.Nullable ReadableArray args) {
Map<String, Integer> commands = getCommandsMap();
if(commands == null) return;
for (Map.Entry<String, Integer> entry : commands.entrySet()) {
if (commandId == entry.getValue()) {
receiveCommand(root, entry.getKey(), args);
}
}
}

@Override
public void receiveCommand(@NonNull ReactPicker root, String commandId, @androidx.annotation.Nullable ReadableArray args) {
Assertions.assertNotNull(root);
Expand Down

0 comments on commit 0d00e13

Please sign in to comment.