forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xplat/js/react-native-github/packages/react-native/ReactAndroid/src/m…
…ain/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java Summary: Changelog: [Internal] Differential Revision: D60233491
- Loading branch information
1 parent
44d38c9
commit 123c894
Showing
2 changed files
with
40 additions
and
56 deletions.
There are no files selected for viewing
56 changes: 0 additions & 56 deletions
56
...d/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...oid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.fabric.mounting.mountitems | ||
|
||
import com.facebook.react.bridge.ReactSoftExceptionLogger | ||
import com.facebook.react.bridge.RetryableMountingLayerException | ||
import com.facebook.react.fabric.mounting.MountingManager | ||
|
||
internal class SendAccessibilityEvent( | ||
private val _surfaceId: Int, | ||
private val reactTag: Int, | ||
private val eventType: Int | ||
) : MountItem { | ||
|
||
private val TAG = "Fabric.SendAccessibilityEvent" | ||
|
||
override public fun execute(mountingManager: MountingManager) { | ||
try { | ||
mountingManager.sendAccessibilityEvent(_surfaceId, reactTag, eventType) | ||
} catch (e: RetryableMountingLayerException) { | ||
// Accessibility events are similar to commands in that they're imperative | ||
// calls from JS, disconnected from the commit lifecycle, and therefore | ||
// inherently unpredictable and dangerous. If we encounter a "retryable" | ||
// error, that is, a known category of errors that this is likely to hit | ||
// due to race conditions (like the view disappearing after the event is | ||
// queued and before it executes), we log a soft exception and continue along. | ||
// Other categories of errors will still cause a hard crash. | ||
ReactSoftExceptionLogger.logSoftException(TAG, e) | ||
} | ||
} | ||
|
||
override public fun getSurfaceId(): Int = _surfaceId | ||
|
||
override public fun toString(): String = "SendAccessibilityEvent [$reactTag] $eventType" | ||
} |