ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Issue with Android 4.4 and Horizontal Scrolling

Open fareesh opened this issue 10 years ago • 13 comments

Short description of the problem:

Tried to build a NetFlix style layout with multiple horizontal scrolling content containers on the page within a main scrollable area within <ion-view> via a main <ion-content> container. The layout also had a left side menu with drag-content="false".

I attempted two implementations of the horizontal scrollers, via <ion-content> as well as <ion-scrolling> but in either case swiping left or right on these elements yielded no result on Android 4.4. I also tried a custom solution with a simple <div style='overflow-x: scroll; white-space: nowrap;'></div>

Since I didn't need a draggable side menu, I commented out all gesture handling code in ionic.bundle.js in the ^ionSideMenus section. Despite having drag-content='false', the gesture handling code still seems to impact horizontal swipe gestures on the aforementioned types of scrolling elements. Commenting out everything related to gesture handling (i.e. everything after //add gesture handlers and before //cleanup) seemed to solve this.

Perhaps setting drag-content to false ought to disable whatever is interfering with the swipe gesture on horizontally scrollable elements on Android 4.4. Unfortunately I'm not familiar enough with the codebase or the specifics of the webview in 4.4 to figure out where exactly the issue is. I've seen the issue across multiple 4.4 devices as well as the 4.4 emulator.

Steps to reproduce:

  1. Start with an example side menus template
  2. Set drag-content to false
  3. Create a horizontally scrollable element via <ion-scroll direction='x'>
  4. Try to swipe horizontally on a device running Android 4.4 or the 4.4 emulator

Which Ionic Version? 1.x or 2.x

Version 1.2.4

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 5.0.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS 
Node Version: v4.3.0

fareesh avatar Mar 11 '16 00:03 fareesh

Thanks for the detailed issue! We really appreciate it! Would you mind posting some code (codepen, repo etc) so that we can easily repro your issue?

jgw96 avatar Mar 11 '16 18:03 jgw96

I've created a repo here: https://github.com/fareesh/ionic-5803

The scroller will not work if you swipe left, however, if you longpress, drag upwards a bit and then drag left, it will scroll. This starts to work as intended when the sidemenu gesture handling code is commented out from ionic.bundle.js.

fareesh avatar Mar 11 '16 19:03 fareesh

+1 I am having the same issue,

brandoncardoso avatar Mar 12 '16 00:03 brandoncardoso

+1

khw828 avatar Mar 14 '16 08:03 khw828

+1, Does someone found a solution to this issue?

jordanrilassi avatar Mar 30 '16 09:03 jordanrilassi

+1 @adamdbradley why did You removed the bug label? This really looks like a bug.

aszmyd avatar Apr 27 '16 05:04 aszmyd

I can confirm that commenting out line gestureOpts.prevent_default_directions = ['left', 'right'] inside source of ionSideMenuContent directive fixes the scrolling but breaks side menu open with content dragging.

aszmyd avatar Apr 27 '16 06:04 aszmyd

I've found some old hack for this kind of situations and after few modifications i've figured out how to enable horizontal scroll. Working example is on my fork of @fareesh repo: https://github.com/aszmyd/ionic-5803

And here are the changes: https://github.com/fareesh/ionic-5803/compare/master...aszmyd:master

aszmyd avatar Apr 27 '16 09:04 aszmyd

+1 i am also faceing same issues

gowrisankarreddy avatar Jun 16 '16 07:06 gowrisankarreddy

Hi every one, I am facing same issue. Please help me.

fkamlesh avatar Aug 09 '16 07:08 fkamlesh

Thanks, I just found the solution with this example : http://codepen.io/anon/pen/dGpzrp

fkamlesh avatar Aug 09 '16 08:08 fkamlesh

I also fixed by using the solution found by @fkamlesh

vagnercsouza avatar Aug 17 '16 20:08 vagnercsouza

Hello all! As their seems to be a valid workaround for this issue and we do not plan on doing major scroll changes to Ionic 1 I am going to be closing this issue for now. Thanks everyone!

jgw96 avatar Sep 01 '16 21:09 jgw96