Nativescript: ScrollView Gesture Issues

Created on 18 Apr 2020  路  3Comments  路  Source: NativeScript/NativeScript

Environment

  • CLI: 6.4
  • Cross-platform modules:
  • Android Runtime: 6.4.1
  • iOS Runtime:
  • Plugin(s):

Describe the bug
If a layout with a pan or swipe event contains a scroll view child, that scroll view will consume panning. Additionally, changing scroll view's 'isUserInteractionEnabled' or 'isScrollEnabled' property to 'false' will not apply as long as parent's pan gesture is in progress.

I see that in such cases it's generally suggested to set pan event to ScrollView itself, but this is quite a limitation.

To Reproduce
Try to move rectangle vertically.
https://play.nativescript.org/?template=play-js&id=mKxeSS&v=34

Expected behavior
'isScrollEnabled' should apply to ScrollView, regardless of each its parent being in gesture mode.

Sample project
https://play.nativescript.org/?template=play-js&id=mKxeSS&v=34

Additional context
There could be an implementation of 'isPassThroughParentEnabled' on ScrollView to get rid of gestures inconveniences.

The solution to this will broaden the possibilities for developers to invent more customizations.
I already have an easy-to-implement custom pull-to-refresh component in mind if this is somehow solved.

enhancement

Most helpful comment

I completely agree @DimitrisRK - would love to have a DOM like api where gestures have a proper propagation cycle: capture, target and bubble phases.

All 3 comments

I managed to solve this on Android, but haven't had time to dig into iOS. This is definitely doable, but would be nice to have a cross-platform way to control easily...

https://play.nativescript.org/?template=play-vue&id=v1t5Pe&v=2

The bottom panel can be dragged up - it has a ScrollView in it, and can still pan the whole thing back down and scroll as you'd expect.

I managed to solve this on Android, but haven't had time to dig into iOS. This is definitely doable, but would be nice to have a cross-platform way to control easily...

https://play.nativescript.org/?template=play-vue&id=v1t5Pe&v=2

The bottom panel can be dragged up - it has a ScrollView in it, and can still pan the whole thing back down and scroll as you'd expect.

Yes, it's possible to implement this natively on both platforms. In android, I think many use "onInterceptTouchEvent" for this kind of behaviour.
I believe this should really be enhanced, as gestures are among the basics of the basics in mobile environment.

I completely agree @DimitrisRK - would love to have a DOM like api where gestures have a proper propagation cycle: capture, target and bubble phases.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hshristov picture hshristov  路  3Comments

rLoka picture rLoka  路  3Comments

minjunlan picture minjunlan  路  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

fmmsilva picture fmmsilva  路  3Comments