[feat]: Add scrolling support to the Parallax component

Open
#2,190 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start by locating the Parallax component and reading how its existing horizontal mode handles scrolling. Implement the proposed scrollable behavior for mouse-wheel input without disrupting the spring animation, then verify that horizontal Parallax instances can navigate with the wheel.

Written by the indexing model from the issue text.

Description

template: request
A clear and concise description of what the feature is

In regards to the Parallax component, currently there is a prop to handle scroll direction, either vertical or horizontal. When horizontal is set to true, mouse wheel functionality is disabled, and users with mice are unable to use the scroll wheel to navigate through the page.

I propose the addition of a prop scrollable that would be a compliment to horizontal where when set to true, users could use the mouse wheel to scroll through the page.

Why should this feature be included?

As it stands, if you need horizontal scrolling as well as the ability to use a mouse wheel to do it, you need to rely on external options which add code to your project, don't play well with React Spring, and perform poorly.

Please provide an example for how this would work
<Parallax
  horizontal={true}
  scrollable={true}
>
  //content
</Parallax>

// the property scrollable would engage an event listener similar to the following:
// ref.current.container.current.scrollLeft += event.deltaY + event.deltaX
// the above solution works, but is janky and doesn't compliment the spring animation implemented by <Parallax>
Dominant language
TypeScript
Stars
29.3k
Forks
1.2k
Avg merge
3d 15h
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pmndrs/react-spring

All issues in pmndrs/react-spring

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.