Detox - cannot use the scroll action on a ScrollView element

Viewed 2658

Unfortunately I can't understand why scroll and scrollTo actions don't work.

This is very strange because the swipe action works fine for the same element.

Of course, the ScrollView element exists and is visible.

Detox version: 16.9.2

Action:

await element(by.id('some')).scrollTo('bottom');

Element:

<ScrollView testID="some">

Error message:

Cannot find UI element.
    Exception with Action: {
      "Action Name":  "Scroll To Bottom content edge",
...

Error Trace: [
      {
        "Description":  "Interaction cannot continue because the desired element was not found.",
        "Error Domain":  "com.google.earlgrey.ElementInteractionErrorDomain",
        "Error Code":  "0",
        "File Name":  "GREYElementInteraction.m",
        "Function Name":  "-[GREYElementInteraction matchedElementsWithTimeout:error:]",
        "Line":  "124"
      }
    ]
1 Answers

try this to see if it works for you:

await waitFor(element.by(id('element_you_looking_for_at_the_bottom')))
   .toBeVisible()
   .whileElement(by.id('some')) // where some is your ScrollView testID
   .scroll(50, 'down')

I had the same problem as you are, so had to use this approach instead

Related