Skip to content

Add scroll behaviour for container elements #27

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

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

Mesoptier
Copy link
Contributor

@Mesoptier Mesoptier commented Jul 21, 2016

Dual of this PR on scroll-behavior

You can use the ScrollContainer component to wrap a scrollable element. The class will handle calling the new registerContainer and unregisterContainer methods on scrollBehavior. Under the hood the scrollBehavior instance is added to the React context, so this class can be used anywhere.

Example code:

import { ScrollContainer } from 'react-router-scroll';

function SomeComponent() {
  return (
    <ScrollContainer scrollKey="someComponent">
      <div style={{ height: 200, overflow: 'auto' }}
        <div style={{ height: 500 }}></div>
      </div>
    </ScrollContainer>
  );
}

@taion
Copy link
Owner

taion commented Jul 21, 2016

This is great. Let's get taion/scroll-behavior#86 merged and released, then I'll look at this in more detail.

@taion
Copy link
Owner

taion commented Aug 5, 2016

I'll clean this up. Thanks!

@taion taion merged commit 062aeb0 into taion:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants