Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnClick and scrolling not working on touch on mobile browsers #168

Open
flogst opened this issue Apr 11, 2023 · 8 comments
Open

OnClick and scrolling not working on touch on mobile browsers #168

flogst opened this issue Apr 11, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@flogst
Copy link

flogst commented Apr 11, 2023

The changes added in 3.0.40 remove the ability to handle onClick events on a React Canvas on mobile browsers. Scrolling on touch is also not working as expected.

To reproduce, I created two examples.

On version 3.0.39 everything is working as expected:
https://codesandbox.io/s/rive-react-canvas-3-0-39-hdlvx4?file=/src/App.js

On version 3.0.40, onClick and scrolling is not working on touch (you can test it using chrome dev tools with the device toolbar to simulate a touch screen device):
https://codesandbox.io/s/rive-react-canvas-3-0-40-ushr62?file=/src/App.js

I assume this is related to the touch and drag interactions? Is it possible to disable them for touch screens?

@zplata
Copy link
Contributor

zplata commented Apr 12, 2023

Ahh, sorry you ran into this! I'd recommend working off 3.0.39 for now then - we'll work on a patch for you to set a flag that allows you to opt out of the behind-the-scenes event listener attachments on the canvas (disabling all Rive listeners), as well as try and be smarter about attaching any event listeners at all if there are none configured on your state machine. Would that work for you?

@flogst
Copy link
Author

flogst commented Apr 13, 2023

That sounds perfect, thank you!

@zplata
Copy link
Contributor

zplata commented May 3, 2023

Hi @flogst - can you try on 4.0.46? You can pass in a shouldDisableRiveListeners: true as a parameter in the useRive params.

@zplata zplata added the bug Something isn't working label May 5, 2023
@flogst
Copy link
Author

flogst commented May 11, 2023

Hi @zplata, thanks for this. It does solve the scrolling issue, however we have one animation where we use a hover listener from Rive directly. So it's not possible to have both, the hover listener and being able to scroll if the animation is touched on a touchscreen?

@RyanMerabet
Copy link

+1

@limichange
Copy link

@flogst But this has the additional problem that there is no way to dynamically change this parameter. Very often, there is a need for interaction on the PC, but not on the phone. That means there needs to be a way to change the parameter directly, not just at initialization time.

@edogbeatz
Copy link

+1

@edogbeatz
Copy link

Wassup folks! are there any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants