From 7fb02bd90884f0a717e8151d4d30767fe38392c1 Mon Sep 17 00:00:00 2001 From: Emily Janzer Date: Thu, 30 May 2019 15:56:55 -0700 Subject: [PATCH] Rename onAccessibilityAction event on Android Summary: D15391408 (https://github.com/facebook/react-native/pull/24695) added a new event type with the registration name 'onAccessibilityAction' on Android, using the key 'performAction'. On iOS the same event uses the key 'topAccessibilityAction', which caused a runtime error after I started registering both using the unified JS view config in D15488008. This diff changes Android to use the same name as iOS since the convention is to start with 'top'. Reviewed By: cpojer Differential Revision: D15542623 fbshipit-source-id: c339621d2b4d3e1700feb5419ae3e3af8b185ca8 --- .../main/java/com/facebook/react/uimanager/BaseViewManager.java | 2 +- .../facebook/react/uimanager/ReactAccessibilityDelegate.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java index 524a4bf60c084e..0e68825e67ed16 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java @@ -376,7 +376,7 @@ protected void onAfterUpdateTransaction(@Nonnull T view) { @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { return MapBuilder.builder() - .put("performAction", MapBuilder.of("registrationName", "onAccessibilityAction")) + .put("topAccessibilityAction", MapBuilder.of("registrationName", "onAccessibilityAction")) .build(); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java index 481f2e2821d669..332114fca6a14d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java @@ -183,7 +183,7 @@ public boolean performAccessibilityAction(View host, int action, Bundle args) { ReactContext reactContext = (ReactContext)host.getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( host.getId(), - "performAction", + "topAccessibilityAction", event); return true; }