Scroll to buttom of page native app


So I’m currently trying scroll to a button that is not shown unless I scroll down on the page.
Basically all searches I do I get the impression im supposed to use “scrollTo()” method but it doesnt work in the
v1.4.16 appium version im using together with java client 4.1.2.

Tried the following:

  1. touchActions() but I just can’t grap how Im supposed to make it work.

  2. A javascript executor like this
    `JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> HiddenButton= new HashMap<String, String>();
    HiddenButton.put(“direction”, “down”);
    js.executeScript(“mobile: scroll”, HiddenButton);
    This code snippet gives me :org.openqa.selenium.WebDriverException: ERROR running Appium command: string is not a function .

So my question to you guy is, how do I scroll down to the buttom of a native app page easiest?
Appreciate all help.
Java, Appium, POM, TestNG,

Solved my scrolling issue thanks to this video ""
Once I declared the correct view where it was supposed to scroll it worked out.

You can use the below custom method to scroll to element. It will keep swiping until the element is visible.

public void scrollToElement(WebElement element) {
    Dimension screenSize = driver.manage().window().getSize();
    int screenWidth = screenSize.getWidth() / 2;
    int screenHight = screenSize.getHeight() - 20;
    // this swipes down the screen until the given element is visible
    if (!element.isDisplayed()) {
        do {
            driver.swipe(screenWidth, screenHight, screenWidth, screenHight - 600, 1000);
        } while (!element.isDisplayed());