Skip to content

Commit 132c2cd

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Fix keyboard navigation if snapToAlignment is set
Summary: There is an issue with keyboard navigation if some scroll view sets `snapToAlignment`. In this case, we are unable to find potential focus candidates if clipping is enabled since this prop will make it so that certain views in the hierarchy under the scroll view form a native view without any traits being set. The fix we have in place currently relies on `FormsStackingContext` to be set to discover potential candidates so it will break in this case. To fix this, we just return the entire ancestor list, since native will know how to deal with the cases that are not actual views, and in general has the official knowledge of what can be in the hierarchy or not. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D77467933 fbshipit-source-id: 35daaba06347c738cf7a85eef86adb7944a9cb26
1 parent 2d1db71 commit 132c2cd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,7 @@ jintArray FabricUIManagerBinding::getRelativeAncestorList(
281281
for (auto it = std::next(ancestorList.begin()); it != ancestorList.end();
282282
++it) {
283283
auto& ancestor = *it;
284-
if (ancestor.first.get().getTraits().check(
285-
ShadowNodeTraits::Trait::FormsStackingContext)) {
286-
ancestorTags.push_back(ancestor.first.get().getTag());
287-
}
284+
ancestorTags.push_back(ancestor.first.get().getTag());
288285
}
289286

290287
jintArray result = env->NewIntArray(static_cast<jint>(ancestorTags.size()));

0 commit comments

Comments
 (0)