Cannot choose the element correctly in the UIScrollable

I need to choose element in a very long scrollable
The code I use:

val using = “new UiScrollable(new UiSelector().scrollable(true)).setMaxSearchSwipes(200).scrollIntoView(new UiSelector().text(”${element}"))"

val el = driver.findElementByAndroidUIAutomator(using)
el.click()

Choosing the element is inconsistent, it chooses element I need in about 30% of the cases, the rest are the elements close to it… How do I fix it?

try change code to something like (I am with Java so writing similar. correct for your lang):

val elLocator = “new UiSelector().text("${element}")”
val using = “new UiScrollable(new UiSelector().scrollable(true)).setMaxSearchSwipes(200).scrollIntoView(" + elLocator + ")“

val el = driver.findElementByAndroidUIAutomator(using)
// try to add here sleep a bit e.g. 100-200ms to complete swipe action
driver.findElementByAndroidUIAutomator(elLocator).click()