question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attaching a touch event handler on ScrollView breaks the scrolling

See original GitHub issue

Attaching a touch event handler like touchstart or touchend to a ScrollView makes the scroll view not scrollable.

var page = tabris.create("Page", {
  title: "Scroll Composite - Horizontal",
  topLevel: true
});

var scrollView = tabris.create("ScrollView", {
  direction: "horizontal",
  layoutData: {left: 0, top: [40, 0], right: 0, bottom: [40, 0]},
  background: "#234"
}).on("touchstart", function(event) {
  console.log("touchstart triggered: " + JSON.stringify(event));
}).appendTo(page);

for (var i = 0; i < 50; i++) {
  tabris.create("TextView", {
    layoutData: {left: i * 30 + 20, centerY: 0, width: 30},
    text: i + "°",
    foreground: "white"
  }).appendTo(scrollView);
}

page.open();

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cpetrovcommented, Mar 23, 2015

tap gesture works fine. Currently touchstart blocks scrolling on Android, but works on iOS. Possible use case would be implementing focus out for custom widgets in a scroll view.

0reactions
mpostcommented, Jun 3, 2019

I just retested the snippet above with the currently nightly and found that the Android client does fire the touch start event, while ios does not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android View stops receiving touch events when parent scrolls
I have a custom Android view which overrides onTouchEvent(MotionEvent) to handle horizontal scrolling of content within the view.
Read more >
Manage touch events in a ViewGroup - Android Developers
Handling touch events in a ViewGroup takes special care, ... However, if you press buttons in the child view, or scroll the child...
Read more >
ScrollView - .NET MAUI - Microsoft Learn
NET MAUI) ScrollView is a view that's capable of scrolling its content. By default, ScrollView scrolls its content vertically.
Read more >
Pager's scroll blocks the ScrollView's scroll · Issue #18 - GitHub
Basically, if a Pager view is placed inside a ScrollView with vertical scroll, the former blocks the parent's scroll, unless the drag gesture...
Read more >
react horizontal swipe
React Swipeable React swipe event handler hook Github Pages Demo Api Use ... doesn't break the window horizontal scroll by adding the addEventListener...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found