Skip to content

Commit ea3e774

Browse files
committed
chore: change findView from async to sync
1 parent 8f710ad commit ea3e774

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ public void handleMessage(Message msg) {
192192
};
193193
}
194194

195+
@Nullable View mAccessibilityLabelledBy;
196+
195197
@Override
196198
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
197199
super.onInitializeAccessibilityNodeInfo(host, info);
@@ -203,19 +205,11 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo
203205

204206
final Object accessibilityLabelledBy = host.getTag(R.id.labelled_by);
205207
if (accessibilityLabelledBy != null) {
206-
ReactFindViewUtil.findView(
207-
host.getRootView(),
208-
new ReactFindViewUtil.OnViewFoundListener() {
209-
@Override
210-
public String getNativeId() {
211-
return (String) accessibilityLabelledBy;
212-
}
213-
214-
@Override
215-
public void onViewFound(View view) {
216-
info.setLabeledBy(view);
217-
}
218-
});
208+
mAccessibilityLabelledBy =
209+
ReactFindViewUtil.findView(host.getRootView(), (String) accessibilityLabelledBy);
210+
if (mAccessibilityLabelledBy != null) {
211+
info.setLabeledBy(mAccessibilityLabelledBy);
212+
}
219213
}
220214

221215
// state is changeable.

0 commit comments

Comments
 (0)