0
votes

Looking for a way to disable the ScrollView bounce or overflow that happens when scrolling reaches the top or bottom of the scroll view.

here how to set the settings in android. Android scrollview remove blue light

3
I figured it out for ios if (app.ios) { scrollView.ios.bounces = false; } with scrollView being an instance of the scrollView you want to disable the bounce on. - JoshSommer

3 Answers

1
votes

Here is a code snippet that might do the trick for you:

if (this.content.ios instanceof UIScrollView) {
        this.content.ios.alwaysBounceVertical = false;
 }

Of course you need to get an instance of the <ScrollView> component from NativeScript and then the native iOS instance.

1
votes

I have a small utility library that has this function and some other handy functions baked into it.

https://github.com/TheOriginalJosh/nativescript-swiss-army-knife

import {SwissArmyKnife} from 'nativescript-swiss-army-knife/nativescript-swiss-army-knife';

...

let scrollView = page.getViewById('myScrollView');

SwissArmyKnife.disableScrollBounce(scrollView);
0
votes

Here is how to do it on iOS and Android.

let scrollView = page.getViewById('myScrollView');
if (app.android) {
    scrollView.android.setOverScrollMode(2);
}
else if (app.ios) {
    scrollView.ios.bounces = false;
}