Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Export context for hooks support #76

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
jscottsmith merged 4 commits into jscottsmith:develop from zalishchuk:master
Oct 1, 2019

Conversation

@zalishchuk
Copy link
Contributor

@zalishchuk zalishchuk commented Sep 24, 2019

Export ParallaxContext for useContext hook support.

Copy link

codecov-io commented Sep 24, 2019
edited
Loading

Codecov Report

Merging #76 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@
## master #76 +/- ##
=======================================
 Coverage 91.27% 91.27% 
=======================================
 Files 26 26 
 Lines 298 298 
 Branches 47 47 
=======================================
 Hits 272 272 
 Misses 22 22 
 Partials 4 4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bca9efe...2a702f6. Read the comment docs.

Copy link
Contributor Author

Also added a useController hook which exposes the parallaxController using React hooks.

Usage example:

import React, { useLayoutEffect } from 'react';
import { useController } from 'react-scroll-parallax';
const App = () => {
 const { parallaxController } = useController();
 useLayoutEffect(() => {
 const handler = () => parallaxController.update();
 window.addEventListener('load', handler);
 return () => window.removeEventListener('load', handler);
 }, [parallaxController]);
 return (
 <div>
 {'...'}
 </div>
 );
};

Copy link
Contributor Author

@jscottsmith any thoughts on this?

Copy link
Owner

Love it.

Can you update the README documenting this export. Your usage example would be good to add there too.

https://github.com/jscottsmith/react-scroll-parallax#parallax-controller-context

Copy link
Contributor Author

Updated the README, check it if everything is fine.

Copy link
Contributor Author

@jscottsmith ping ✋

Copy link
Owner

Looks good, I’ll get it merged and publish a new release tonight.

Thanks for the contribution!

@jscottsmith jscottsmith changed the base branch from master to develop October 1, 2019 04:47
@jscottsmith jscottsmith merged commit 2797719 into jscottsmith:develop Oct 1, 2019
Copy link
Owner

@zalishchuk published 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jscottsmith jscottsmith jscottsmith approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /