Skip to content

Commit

Permalink
fix re-mounting ParallaxProvider #9
Browse files Browse the repository at this point in the history
  • Loading branch information
jscottsmith committed Oct 25, 2017
1 parent f940f9d commit 82982c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions example/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import React, { Component } from 'react';
// import PropTypes from 'prop-types';
import { ParallaxProvider } from 'react-scroll-parallax';
import { ParallaxTest } from 'components';

export default class App extends Component {
// this just serves to test unmount/re-mount ParallaxProvider
state = {
mount: true,
};

render() {
return (
<ParallaxProvider>
<ParallaxTest />
</ParallaxProvider>
<main>
{this.state.mount ? (
<ParallaxProvider>
<ParallaxTest />
</ParallaxProvider>
) : (
<div />
)}
</main>
);
}
}
1 change: 1 addition & 0 deletions src/libs/ParallaxController.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ function ParallaxController() {
this.destroy = function() {
_removeListeners();
_removeParallaxStyles();
window.ParallaxController = null;
};
}

Expand Down

0 comments on commit 82982c7

Please sign in to comment.