Reputation: 159
The ScrollView isUserInteractionEnabled parameter doesn't behave the same on NativeScript runtime version 5.0.0 as it did on 4.2.0 for Android.
No script files required. All you need is this XML to observe this problem:
<Page class="page" xmlns="http://www.nativescript.org/tns.xsd">
<ActionBar title="Horizontal Scroll Bug" class="action-bar">
</ActionBar>
<StackLayout>
<Label text="ScrollView's isUserInteractionEnabled property is false."
padding="10" textWrap="true" fontSize="20" />
<ScrollView id="horizontalScroll" orientation="horizontal" isUserInteractionEnabled="false">
<StackLayout orientation="horizontal">
<StackLayout backgroundColor="yellow">
<Label text="Box 1" padding="70" />
</StackLayout>
<StackLayout backgroundColor="red">
<Label text="Box 2" padding="70" />
</StackLayout>
<StackLayout backgroundColor="blue">
<Label text="Box 3" padding="70" />
</StackLayout>
<StackLayout backgroundColor="green">
<Label text="Box 4" padding="70" />
</StackLayout>
<StackLayout backgroundColor="purple">
<Label text="Box 5" padding="70" />
</StackLayout>
<StackLayout backgroundColor="orange">
<Label text="Box 6" padding="70" />
</StackLayout>
</StackLayout>
</ScrollView>
<Label text="Try to scroll the colored boxes above to the right and left to reveal more boxes. You shouldn't be able to."
padding="10" textWrap="true" fontSize="20" />
<Label text="On Android with run time version 4.2.0 you can't, but on run time version 5.0.0 you can."
padding="10" textWrap="true" fontSize="20" />
</StackLayout>
</Page>
I posted the app on NativeScript playground here if you want to scan the QR code: https://play.nativescript.org/?template=play-js&id=hKrNlK
Upvotes: 0
Views: 63
Reputation: 21908
Disable scroll when isUserInteractionEnabled
is set to false
- This seems to be a behavioural change introduced in {N} 5.x. At same time I'm unsure whether this was intentional, you might want to report this at Github.
Meanwhile you may use this workaround.
Upvotes: 1