Skip to content

Commit dcb56ed

Browse files
committed
Merge branch 'release/2.3.5'
2 parents 2f5736d + e948a65 commit dcb56ed

File tree

3 files changed

+50
-39
lines changed

3 files changed

+50
-39
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-scroll-parallax",
3-
"version": "2.3.3",
3+
"version": "2.3.5",
44
"description": "React components to create parallax scroll effects for banners, images or any other DOM elements.",
55
"repository": {
66
"type": "git",

src/classes/ParallaxController.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ function ParallaxController({ scrollAxis = VERTICAL, scrollContainer }) {
9191
* attributes, if so set the elements parallax styles.
9292
*/
9393
function _updateAllElements({ updateCache } = {}) {
94-
elements.forEach(element => {
95-
_updateElementPosition(element);
96-
if (updateCache) {
97-
element.setCachedAttributes(view, scroll);
98-
}
99-
});
94+
if (elements) {
95+
elements.forEach(element => {
96+
_updateElementPosition(element);
97+
if (updateCache) {
98+
element.setCachedAttributes(view, scroll);
99+
}
100+
});
101+
}
100102
// reset ticking so more animations can be called
101103
ticking = false;
102104
}
@@ -151,7 +153,7 @@ function ParallaxController({ scrollAxis = VERTICAL, scrollContainer }) {
151153
this.createElement = function(options) {
152154
const newElement = new Element({ ...options, scrollAxis });
153155
newElement.setCachedAttributes(view, scroll);
154-
elements = [...elements, newElement];
156+
elements = elements ? [...elements, newElement] : [newElement];
155157
_updateElementPosition(newElement);
156158
return newElement;
157159
};
@@ -171,12 +173,14 @@ function ParallaxController({ scrollAxis = VERTICAL, scrollContainer }) {
171173
* @param {object} options
172174
*/
173175
this.updateElementPropsById = function(id, props) {
174-
elements = elements.map(el => {
175-
if (el.id === id) {
176-
return el.updateProps(props);
177-
}
178-
return el;
179-
});
176+
if (elements) {
177+
elements = elements.map(el => {
178+
if (el.id === id) {
179+
return el.updateProps(props);
180+
}
181+
return el;
182+
});
183+
}
180184

181185
this.update();
182186
};
@@ -214,7 +218,9 @@ function ParallaxController({ scrollAxis = VERTICAL, scrollContainer }) {
214218
*/
215219
this.destroy = function() {
216220
_removeListeners(viewEl);
217-
elements.forEach(element => resetStyles(element));
221+
if (elements) {
222+
elements.forEach(element => resetStyles(element));
223+
}
218224
elements = undefined;
219225
};
220226
}

yarn.lock

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,9 +2814,9 @@ bluebird@^3.3.5, bluebird@^3.5.5:
28142814
integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
28152815

28162816
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
2817-
version "4.11.8"
2818-
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
2819-
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
2817+
version "4.11.9"
2818+
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
2819+
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
28202820

28212821
body-parser@1.19.0:
28222822
version "1.19.0"
@@ -3330,9 +3330,9 @@ code-point-at@^1.0.0:
33303330
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
33313331

33323332
codecov@^3.0.0:
3333-
version "3.6.5"
3334-
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.6.5.tgz#d73ce62e8a021f5249f54b073e6f2d6a513f172a"
3335-
integrity sha512-v48WuDMUug6JXwmmfsMzhCHRnhUf8O3duqXvltaYJKrO1OekZWpB/eH6iIoaxMl8Qli0+u3OxptdsBOYiD7VAQ==
3333+
version "3.7.1"
3334+
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.7.1.tgz#434cb8d55f18ef01672e5739d3d266696bebc202"
3335+
integrity sha512-JHWxyPTkMLLJn9SmKJnwAnvY09kg2Os2+Ux+GG7LwZ9g8gzDDISpIN5wAsH1UBaafA/yGcd3KofMaorE8qd6Lw==
33363336
dependencies:
33373337
argv "0.0.2"
33383338
ignore-walk "3.0.3"
@@ -4105,9 +4105,9 @@ element-resize-detector@^1.1.15:
41054105
batch-processor "^1.0.0"
41064106

41074107
elliptic@^6.0.0:
4108-
version "6.5.1"
4109-
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b"
4110-
integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==
4108+
version "6.5.3"
4109+
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
4110+
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
41114111
dependencies:
41124112
bn.js "^4.4.0"
41134113
brorand "^1.0.1"
@@ -6725,10 +6725,10 @@ lodash.unescape@4.0.1:
67256725
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
67266726
integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
67276727

6728-
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@~4.17.10:
6729-
version "4.17.15"
6730-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
6731-
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
6728+
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@~4.17.10:
6729+
version "4.17.20"
6730+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
6731+
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
67326732

67336733
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0:
67346734
version "1.4.0"
@@ -6823,9 +6823,9 @@ map-visit@^1.0.0:
68236823
object-visit "^1.0.0"
68246824

68256825
markdown-to-jsx@^6.9.1, markdown-to-jsx@^6.9.3:
6826-
version "6.10.3"
6827-
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.10.3.tgz#7f0946684acd321125ff2de7fd258a9b9c7c40b7"
6828-
integrity sha512-PSoUyLnW/xoW6RsxZrquSSz5eGEOTwa15H5eqp3enmrp8esmgDJmhzd6zmQ9tgAA9TxJzx1Hmf3incYU/IamoQ==
6826+
version "6.11.4"
6827+
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.11.4.tgz#b4528b1ab668aef7fe61c1535c27e837819392c5"
6828+
integrity sha512-3lRCD5Sh+tfA52iGgfs/XZiw33f7fFX9Bn55aNnVNUd2GzLDkOWyKYYD8Yju2B1Vn+feiEdgJs8T6Tg0xNokPw==
68296829
dependencies:
68306830
prop-types "^15.6.2"
68316831
unquote "^1.1.0"
@@ -7312,9 +7312,9 @@ node-releases@^1.1.29:
73127312
semver "^5.3.0"
73137313

73147314
node-sass@^4.5.0:
7315-
version "4.12.0"
7316-
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017"
7317-
integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==
7315+
version "4.13.1"
7316+
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.1.tgz#9db5689696bb2eec2c32b98bfea4c7a2e992d0a3"
7317+
integrity sha512-TTWFx+ZhyDx1Biiez2nB0L3YrCZ/8oHagaDalbuBSlqXgUPsdkUSzJsVxeDO9LtPB49+Fh3WQl3slABo6AotNw==
73187318
dependencies:
73197319
async-foreach "^0.1.3"
73207320
chalk "^1.1.1"
@@ -7323,7 +7323,7 @@ node-sass@^4.5.0:
73237323
get-stdin "^4.0.1"
73247324
glob "^7.0.3"
73257325
in-publish "^2.0.0"
7326-
lodash "^4.17.11"
7326+
lodash "^4.17.15"
73277327
meow "^3.7.0"
73287328
mkdirp "^0.5.1"
73297329
nan "^2.13.2"
@@ -8497,11 +8497,16 @@ react-inspector@^3.0.2:
84978497
is-dom "^1.0.9"
84988498
prop-types "^15.6.1"
84998499

8500-
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0:
8500+
react-is@^16.7.0, react-is@^16.8.4, react-is@^16.9.0:
85018501
version "16.9.0"
85028502
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb"
85038503
integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw==
85048504

8505+
react-is@^16.8.1:
8506+
version "16.13.1"
8507+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
8508+
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
8509+
85058510
react-lifecycles-compat@^3.0.4:
85068511
version "3.0.4"
85078512
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
@@ -10459,9 +10464,9 @@ websocket-driver@>=0.5.1:
1045910464
websocket-extensions ">=0.1.1"
1046010465

1046110466
websocket-extensions@>=0.1.1:
10462-
version "0.1.3"
10463-
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29"
10464-
integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==
10467+
version "0.1.4"
10468+
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
10469+
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
1046510470

1046610471
whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3:
1046710472
version "1.0.5"

0 commit comments

Comments
 (0)