Skip to content

Commit 0d70296

Browse files
committed
only pass required props when creating/updating parallax elements
1 parent 994371d commit 0d70296

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/components/Parallax.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,30 @@ export default class Parallax extends Component {
3535
this.element = ParallaxController.createElement({
3636
elInner: this._inner,
3737
elOuter: this._outer,
38-
props: this.props,
38+
props: {
39+
disabled: this.props.disabled,
40+
offsetXMax: this.props.offsetXMax,
41+
offsetXMin: this.props.offsetXMin,
42+
offsetYMax: this.props.offsetYMax,
43+
offsetYMin: this.props.offsetYMin,
44+
slowerScrollRate: this.props.slowerScrollRate,
45+
},
3946
});
4047
}
4148

4249
componentWillReceiveProps(nextProps) {
4350
// updates the elements props when changed
4451
if (this.props !== nextProps) {
45-
ParallaxController.updateElement(this.element, { props: nextProps });
52+
ParallaxController.updateElement(this.element, {
53+
props: {
54+
disabled: nextProps.disabled,
55+
offsetXMax: nextProps.offsetXMax,
56+
offsetXMin: nextProps.offsetXMin,
57+
offsetYMax: nextProps.offsetYMax,
58+
offsetYMin: nextProps.offsetYMin,
59+
slowerScrollRate: nextProps.slowerScrollRate,
60+
},
61+
});
4662
}
4763
// resets element styles when disabled
4864
if (this.props.disabled !== nextProps.disabled && nextProps.disabled) {

0 commit comments

Comments
 (0)