mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
99b7052248
Summary: `sendAccessibilityEvent_unstable` is a cross-platform, Fabric/non-Fabric replacement for previous APIs (which went through UIManager directly on Android, and a native module on iOS). Changelog: [Added] sendAccessibilityEvent_unstable API in AccessibilityInfo and sendAccessibilityEvent in React renderer Reviewed By: kacieb Differential Revision: D25821052 fbshipit-source-id: 03f7a9878c95e8395f9102b3e596bfc9f03730e0
32 lines
760 B
JavaScript
32 lines
760 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow strict-local
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import UIManager from '../../ReactNative/UIManager';
|
|
|
|
/**
|
|
* This is a function exposed to the React Renderer that can be used by the
|
|
* pre-Fabric renderer to emit accessibility events to pre-Fabric nodes.
|
|
*/
|
|
function legacySendAccessibilityEvent(
|
|
reactTag: number,
|
|
eventType: string,
|
|
): void {
|
|
if (eventType === 'focus') {
|
|
UIManager.sendAccessibilityEvent(
|
|
reactTag,
|
|
UIManager.getConstants().AccessibilityEventTypes.typeViewFocused,
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = legacySendAccessibilityEvent;
|