-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested ScrollView cause "Multiple UI elements match" #164
Comments
I am also facing this issue with nested scrollViews. Is there any known workaround? |
I use slow swipe |
In my case, I got the same error using scroll and swipe |
Looks like async scroll(amount, direction = 'down') {
// override the user's element selection with an extended matcher that looks for UIScrollView children
this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
return await new ActionInteraction(this, new ScrollAmountAction(direction, amount)).execute();
} in Could you explain why the matcher should descend to subviews by default? Would be nice to know if it's necessary before I try to implement something like |
@anton6 No, I did try it. But I lacked the time to dive deep enough into the code to make it work. |
We had the same issue trying to scroll when selecting the outer scrollview. There was not a scrollview, but a FlatList nested within. Tried adding the fix in #458, but it didn't seem to change the error. We removed the flatlist, and just went with an array of elements in the meantime. |
@kylemellander Could you please comment on the PR, stating your problem? |
Hm I have the same problem, but instead of nested scrollviews I have one scrollview and one textinput with multiple lines set to I only state the testID on the scrollview this action: And atIndex(0) usage like this: |
Any progress? |
We'll look at this soon. Thanks |
@LeoNatan - can we set some higher priority on this? I have the same issue as @Jhonte I have a <ScrollView testID={"scrollViewCompanyForm"}> and inside it I have a my test code
and here is the RN code:
I've tried matching for the companyForm and then doing withDescendant. I tried matchin for scrollViewCompanyForm and then doing withAscending. I tried indexAt - it doesn't work. If I add the changes from this PR: https://github.com/wix/detox/pull/458/files to scrollTo. basically just this.atIndex(0); -> then my view is scrolled... |
So, here's the hack my team used to fix this problem...
and then we added the fix from PR 458 into the postinstall.js
|
An alternative option is https://github.com/ds300/patch-package which automates this process of manually patching an npm package and makes it safer by committing the patch to git. |
@Protothor, any status on the pull request for this? it was closed 5 days ago for inactivity. |
@Protothor I tried the approach you put. However, It doesn't seems to be working with nested scrollview or maybe the one I am using is 1 scrollview outside and a flatlist inside? Thank you. |
I just used @Protothor approach but with @Leeds-eBooks patch-package recommendation... Works like a charm... |
Is there any update on a possible fix/PR for this? |
I got similar log error with multiple RCTCustomScrollView: Error: Multiple UI elements matched for given criteria.
Exception with Assertion: {
"Assertion Criteria" : "assertWithMatcher:matcherForSufficientlyVisible(>=0.750000)",
"Element Matcher" : "(((respondsToSelector(accessibilityIdentifier) && accessibilityID('view_calendar')) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((respondsToSelector(accessibilityIdentifier) && accessibilityID('view_calendar')) && kindOfClass('RCTScrollView'))))))",
"Recovery Suggestion" : "Create a more specific matcher to narrow matched element"
}
Error Trace: [
{
"Description" : "Multiple elements were matched: (
"<RCTCustomScrollView:0x7ff8328bc800; AX=N; AX.frame={{0, 128}, {414, 553}}; AX.activationPoint={207, 404.5}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 553}}; opaque; alpha=1>",
"<RCTCustomScrollView:0x7ff83287c600; AX=N; AX.frame={{0, 196}, {414, 21.333333333333343}}; AX.activationPoint={207, 206.66666666666669}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 21.333333333333332}}; opaque; alpha=1>",
"<RCTCustomScrollView:0x7ff8320bba00; AX=N; AX.frame={{0, 146}, {414, 49}}; AX.activationPoint={207, 170.5}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {414, 49}}; opaque; alpha=1>" I am using native-base UI components. I found adding 'testID' to Component creates the issue. My way to fixed temporally, by using other component with testID or using from react-native. NOTE: Note sure why Content create multiple elements, pending investigation. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@LeoNatan would you mind commenting on this? To me it seems as a major bug that some of us are going around by applying a patch. Are you guys not running into this issue? that is the first problem I ran when I started using detox... |
We have not run into this issue, and I am not actively working on Detox right now. If someone wants to debug this and submit a PR with a fix (or at least an analysis of where the issue lies), that would be great. |
@compojoom Can you quickly please create a small demo project reproducing the issue? |
will send you a link this afternoon. |
@LeoNatan there you go https://github.com/compojoom/DetoxScrollBug |
Excellent, thank you |
Good news, we might fix this soon. See #896 |
Please test and let us know if the fix solved your problem. Thank you |
Nested ScrollView cause Multiple UI elements match
Steps to reproduce
scroll
,swipe
Actual result:
Expected result
The text was updated successfully, but these errors were encountered: