diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js index d619b897254e93..28e794d19a3628 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js @@ -26,7 +26,7 @@ type AccessibilityEventDefinitions = { change: [boolean], }; -type AccessibilityEventTypes = 'focus'; +type AccessibilityEventTypes = 'focus' | 'click'; const _subscriptions = new Map(); @@ -162,7 +162,12 @@ const AccessibilityInfo = { eventType: AccessibilityEventTypes, ) { // route through React renderer to distinguish between Fabric and non-Fabric handles - sendAccessibilityEvent(handle, eventType); + // iOS only supports 'focus' event types + if (eventType === 'focus') { + sendAccessibilityEvent(handle, eventType); + } else if (eventType === 'click') { + // Do nothing! + } }, /** diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js index bcdefd1eae3e98..c55be9371e3ecf 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js @@ -43,7 +43,8 @@ type AccessibilityEventDefinitions = { ], }; -type AccessibilityEventTypes = 'focus'; +// 'click' event type is not implemented in iOS. It's declared here to avoid flow type errors +type AccessibilityEventTypes = 'focus' | 'click'; const _subscriptions = new Map(); diff --git a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js index edc950427d6b9f..3bb1c554950d50 100644 --- a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js +++ b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js @@ -24,6 +24,12 @@ function legacySendAccessibilityEvent( UIManager.getConstants().AccessibilityEventTypes.typeViewFocused, ); } + if (eventType === 'click') { + UIManager.sendAccessibilityEvent( + reactTag, + UIManager.getConstants().AccessibilityEventTypes.typeViewClicked, + ); + } } module.exports = legacySendAccessibilityEvent;