Skip to content

Commit 2d2082c

Browse files
committed
Merge branch 'develop'
2 parents 872a09b + 1413323 commit 2d2082c

File tree

7 files changed

+7675
-5626
lines changed

7 files changed

+7675
-5626
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ Props:
7676

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

9191
## Types
9292

example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"react-dom": "^16.4.1",
1212
"react-gsap": "1.0.16",
1313
"react-router-dom": "^4.3.1",
14-
"react-scripts": "2.0.5",
14+
"react-scripts": "3.0.0",
1515
"react-scrollmagic": "link:..",
1616
"styled-components": "^3.4.9"
1717
},

example/src/components/ScrollMagicExamples/Sticky.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Sticky = () => (
2626
<StickyStyled>
2727
<div className="section" />
2828
<Controller>
29-
<Scene duration={600} pin={true}>
29+
<Scene duration={600} pin={true} enabled={true}>
3030
<div className="sticky"><div>Pin Test</div></div>
3131
</Scene>
3232
<Scene duration={200} pin={{ pushFollowers: false }}>

example/yarn.lock

+4,144-3,679
Large diffs are not rendered by default.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-scrollmagic",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "React declarative component for ScrollMagic",
55
"author": "bitworking",
66
"license": "MIT",
@@ -49,8 +49,8 @@
4949
"gh-pages": "2.0.0",
5050
"react": "^16.4.1",
5151
"react-dom": "^16.4.1",
52-
"react-scripts": "2.0.5",
53-
"rollup": "^0.64.1",
52+
"react-scripts": "3.0.0",
53+
"rollup": "0.68.2",
5454
"rollup-plugin-babel": "^3.0.7",
5555
"rollup-plugin-commonjs": "^9.1.3",
5656
"rollup-plugin-cpy": "^1.0.0",

src/Scene.js

+39
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,48 @@ class SceneBase extends React.PureComponent<SceneBaseProps, SceneBaseState> {
136136
this.scene.addIndicators({ name: ' ' });
137137
}
138138

139+
if (enabled !== undefined) {
140+
this.scene.enabled(enabled);
141+
}
142+
139143
this.scene.addTo(controller);
140144
}
141145

146+
componentDidUpdate(prevProps: SceneBaseProps) {
147+
const {
148+
duration,
149+
offset,
150+
triggerElement,
151+
triggerHook,
152+
reverse,
153+
enabled,
154+
} = this.props;
155+
156+
if (duration !== undefined && duration !== prevProps.duration) {
157+
this.scene.duration(duration);
158+
}
159+
160+
if (offset !== undefined && offset !== prevProps.offset) {
161+
this.scene.offset(offset);
162+
}
163+
164+
if (triggerElement !== undefined && triggerElement !== prevProps.triggerElement) {
165+
// this.scene.triggerElement(triggerElement);
166+
}
167+
168+
if (triggerHook !== undefined && triggerHook !== prevProps.triggerHook) {
169+
this.scene.triggerHook(triggerHook);
170+
}
171+
172+
if (reverse !== undefined && reverse !== prevProps.reverse) {
173+
this.scene.reverse(reverse);
174+
}
175+
176+
if (enabled !== undefined && enabled !== prevProps.enabled) {
177+
this.scene.enabled(enabled);
178+
}
179+
}
180+
142181
componentWillUnmount() {
143182
this.scene.destroy();
144183
}

0 commit comments

Comments
 (0)