react-scroll-horizontal icon indicating copy to clipboard operation
react-scroll-horizontal copied to clipboard

Mobile/Touch Support

Open hew opened this issue 8 years ago • 12 comments

Coming in the next update.

hew avatar Apr 27 '16 23:04 hew

ETA?

mbrevda avatar Aug 19 '16 12:08 mbrevda

I can push it out this weekend maybe. It's coded, just been busy.

hew avatar Aug 19 '16 16:08 hew

can you please push touch updates for this plugin.

pavanmehta91 avatar Sep 22 '16 10:09 pavanmehta91

So just to keep everyone updated:

I have been working on this. I thought I had a quick fix, but it turns out it wasn't viable. I think I am close to a solution using react-draggable but it's not there yet. Of course, if anyone wants to try tackling this, I am more than open to pull requests.

hew avatar Sep 29 '16 16:09 hew

@hew I’m working locally on a fork and I got it working with Draggable. But… It’s weird. I wrap everything in Draggable, set it to only drag horizontally, then set the first child transform CSS to translate(0px, 0px)!important. This gives me a deltaX value without actually moving any UI on drag. I then set animValues state with this value.

I think this approach is fine because we need a way to not actually drag UI, but let React Motion handle the movement, so the “ghost” UI makes sense.

Some possible Issues with this approach:

  1. Draggable still tries to set translate on drag but we don’t use this at all
  2. Loading all of Draggable just to get a onDrag method

Performance wise this works perfectly for me. It’s very smooth and looks nice.

zachgibson avatar Mar 09 '18 16:03 zachgibson

@hew @zachgibson I am curious if any1 minds providing example code 4 how 2 implement this? Thanks from a fan :)

quinnliu avatar Feb 03 '19 18:02 quinnliu

If somebody could provide implementation will be great

jjalonso avatar Apr 24 '20 12:04 jjalonso

can we see this in action please

jonrrivera avatar Aug 21 '20 19:08 jonrrivera

A quick and dirty solution to allow scrolling via touch devices is to use the following SCSS/less style:

@media (hover: none), (pointer:coarse), (-moz-touch-enabled: 1) {
    .scroll-horizontal {
        overflow: scroll !important;
        overflow: overlay !important;
        overflow-x: scroll !important;
        overflow-x: overlay !important;
        overflow-y: hidden !important;
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;

        &>div {
            transform: none !important;
            position: relative;
        }

        &::-webkit-scrollbar {
            display: none !important;
        }
    }
}

falahati avatar Mar 24 '21 12:03 falahati

Hello, How can I use touch/mobile support?

flimybook avatar Dec 29 '21 06:12 flimybook

A quick and dirty solution to allow scrolling via touch devices is to use the following SCSS/less style:

@media (hover: none), (pointer:coarse), (-moz-touch-enabled: 1) {
    .scroll-horizontal {
        overflow: scroll !important;
        overflow: overlay !important;
        overflow-x: scroll !important;
        overflow-x: overlay !important;
        overflow-y: hidden !important;
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;

        &>div {
            transform: none !important;
            position: relative;
        }

        &::-webkit-scrollbar {
            display: none !important;
        }
    }
}

Interesting! Thanks for sharing.

hew avatar Jan 31 '22 22:01 hew

+1 following for any further developments

jamesryan-dev avatar Apr 26 '22 18:04 jamesryan-dev