mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
perf(android): batch setupAccessibleView calls to improve TTI (#10391)
This commit is contained in:
@ -442,13 +442,28 @@ export function setupAccessibleView(view: View): void {
|
|||||||
updateAccessibilityProperties(view);
|
updateAccessibilityProperties(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateAccessibilityProperties(view: View): void {
|
let updateAccessibilityPropertiesMicroTask;
|
||||||
|
let pendingViews = new Set<View>();
|
||||||
|
export function updateAccessibilityProperties(view: View) {
|
||||||
if (!view.nativeViewProtected) {
|
if (!view.nativeViewProtected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pendingViews.add(view);
|
||||||
|
if (updateAccessibilityPropertiesMicroTask) return;
|
||||||
|
|
||||||
|
updateAccessibilityPropertiesMicroTask = true;
|
||||||
|
Promise.resolve().then(() => {
|
||||||
|
updateAccessibilityPropertiesMicroTask = false;
|
||||||
|
let _pendingViews = Array.from(pendingViews);
|
||||||
|
pendingViews = new Set();
|
||||||
|
for (const view of _pendingViews) {
|
||||||
|
if (!view.nativeViewProtected) continue;
|
||||||
setAccessibilityDelegate(view);
|
setAccessibilityDelegate(view);
|
||||||
applyContentDescription(view);
|
applyContentDescription(view);
|
||||||
|
}
|
||||||
|
_pendingViews = [];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendAccessibilityEvent(view: View, eventType: AndroidAccessibilityEvent, text?: string): void {
|
export function sendAccessibilityEvent(view: View, eventType: AndroidAccessibilityEvent, text?: string): void {
|
||||||
|
Reference in New Issue
Block a user