mkosir / react-parallax-tilt

πŸ‘€ Easily apply tilt hover effect on React components - lightweight/zero dependencies (3kB)

Home Page:https://mkosir.github.io/react-parallax-tilt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't log Device Orientation as an error

sumanthratna opened this issue Β· comments

πŸ› Issue/Bug Report Template

Describe the bug
When devices don't support gyroscope/device orientation, there's an error in the console. It'd be nice to try/catch this and instead log a warning.

To Reproduce
Steps to reproduce the behavior:

  1. Launch a parallax site with gyroscope enabled
  2. Open developer console
  3. See error

Expected behavior
Instead of logging an error, log as a warning in development mode (and maybe don't log anything in production?)

Link to demo (highly encouraged)

Code snippets
If applicable, add code samples to help explain your problem.

Environment

  • Browser: Safari 14.0 (16610.1.15.51.2) on macOS Big Sur (10.16; not Apple Silicon)
  • Version: "react-parallax-tilt": 1.4.56

Additional context
n/a

Hi @sumanthratna, thanks for the feedback!
Nice suggestion, I agree with showing a warning only in development mode.
Would you like to take a stab at this and create PR?

Sure! I just created a PRβ€”let me know if you think this warrants a note in the README under https://github.com/mkosir/react-parallax-tilt#props.

Looks great, thanks for the PR πŸš€