Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bitworking committed Jul 17, 2019
2 parents 872a09b + 1413323 commit 2d2082c
Show file tree
Hide file tree
Showing 7 changed files with 7,675 additions and 5,626 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ Props:

name | type | optional | default | more info
--- | --- | --- | --- | ---
duration | number or string | yes | 0
offset | number or string | yes | 0
duration | number or string | yes | 0 | Can be changed on-the-fly
offset | number or string | yes | 0 | Can be changed on-the-fly
triggerElement | string, object or null | yes | child element
triggerHook | number or string | yes | "onCenter" | [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#constructor)
reverse | boolean | yes | true
triggerHook | number or string | yes | "onCenter" | [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#constructor) (Can be changed on-the-fly)
reverse | boolean | yes | true | Can be changed on-the-fly
loglevel | number | yes | 2
indicators | boolean | yes | false | only boolean in contrast to plugin options: [link](http://scrollmagic.io/docs/debug.addIndicators.html#Scene.addIndicators)
classToggle | string or string[2] | yes | undefined | [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#setClassToggle)
pin | boolean or string | yes | undefined | [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#setPin)
pinSettings | PinSettings | yes | undefined | See Types and [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#setPin)

enabled | boolean | yes | true | Can be changed on-the-fly

## Types

Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"react-dom": "^16.4.1",
"react-gsap": "1.0.16",
"react-router-dom": "^4.3.1",
"react-scripts": "2.0.5",
"react-scripts": "3.0.0",
"react-scrollmagic": "link:..",
"styled-components": "^3.4.9"
},
Expand Down
2 changes: 1 addition & 1 deletion example/src/components/ScrollMagicExamples/Sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Sticky = () => (
<StickyStyled>
<div className="section" />
<Controller>
<Scene duration={600} pin={true}>
<Scene duration={600} pin={true} enabled={true}>
<div className="sticky"><div>Pin Test</div></div>
</Scene>
<Scene duration={200} pin={{ pushFollowers: false }}>
Expand Down
7,823 changes: 4,144 additions & 3,679 deletions example/yarn.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-scrollmagic",
"version": "2.1.0",
"version": "2.1.1",
"description": "React declarative component for ScrollMagic",
"author": "bitworking",
"license": "MIT",
Expand Down Expand Up @@ -49,8 +49,8 @@
"gh-pages": "2.0.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "2.0.5",
"rollup": "^0.64.1",
"react-scripts": "3.0.0",
"rollup": "0.68.2",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-cpy": "^1.0.0",
Expand Down
39 changes: 39 additions & 0 deletions src/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,48 @@ class SceneBase extends React.PureComponent<SceneBaseProps, SceneBaseState> {
this.scene.addIndicators({ name: ' ' });
}

if (enabled !== undefined) {
this.scene.enabled(enabled);
}

this.scene.addTo(controller);
}

componentDidUpdate(prevProps: SceneBaseProps) {
const {
duration,
offset,
triggerElement,
triggerHook,
reverse,
enabled,
} = this.props;

if (duration !== undefined && duration !== prevProps.duration) {
this.scene.duration(duration);
}

if (offset !== undefined && offset !== prevProps.offset) {
this.scene.offset(offset);
}

if (triggerElement !== undefined && triggerElement !== prevProps.triggerElement) {
// this.scene.triggerElement(triggerElement);
}

if (triggerHook !== undefined && triggerHook !== prevProps.triggerHook) {
this.scene.triggerHook(triggerHook);
}

if (reverse !== undefined && reverse !== prevProps.reverse) {
this.scene.reverse(reverse);
}

if (enabled !== undefined && enabled !== prevProps.enabled) {
this.scene.enabled(enabled);
}
}

componentWillUnmount() {
this.scene.destroy();
}
Expand Down
Loading

0 comments on commit 2d2082c

Please sign in to comment.