Skip to content

Commit d252415

Browse files
committed
remove object-assign
1 parent 0c9b16d commit d252415

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"lint"
5353
],
5454
"dependencies": {
55-
"object-assign": "4.0.x",
5655
"raf": "3.1.x",
5756
"rc-tween-one": "~0.8.0",
5857
"tween-functions": "1.0.x"

src/ScrollLink.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
import React, { createElement } from 'react';
55
import ReactDOM from 'react-dom';
6-
import assign from 'object-assign';
76
import easingTypes from 'tween-functions';
87
import requestAnimationFrame from 'raf';
98
import EventListener from './EventDispatcher';
@@ -53,7 +52,7 @@ class ScrollLink extends React.Component {
5352
this.scrollTop = currentScrollTop();
5453
const toTop = Math.round(elementRect.top) - Math.round(docRect.top);
5554
this.toTop = this.props.toShowHeight ?
56-
toTop - transformArguments(this.props.showHeightActive)[0] : toTop;
55+
toTop - transformArguments(this.props.showHeightActive)[0] : toTop;
5756
this.initTime = Date.now();
5857
this.rafID = requestAnimationFrame(this.raf);
5958
}
@@ -94,12 +93,12 @@ class ScrollLink extends React.Component {
9493
const top = Math.round(docRect.top - elementRect.top + scrollTop);
9594
const showHeightActive = transformArguments(this.props.showHeightActive);
9695
const startShowHeight = showHeightActive[0].toString().indexOf('%') >= 0 ?
97-
parseFloat(showHeightActive[0]) / 100 * clientHeight :
96+
parseFloat(showHeightActive[0]) / 100 * clientHeight :
9897
parseFloat(showHeightActive[0]);
9998
const endShowHeight = showHeightActive[1].toString().indexOf('%') >= 0 ?
100-
parseFloat(showHeightActive[1]) / 100 * clientHeight :
99+
parseFloat(showHeightActive[1]) / 100 * clientHeight :
101100
parseFloat(showHeightActive[1]);
102-
if (top >= - startShowHeight && top < elementClientHeight - endShowHeight) {
101+
if (top >= -startShowHeight && top < elementClientHeight - endShowHeight) {
103102
if (!this.props.onFocus.only) {
104103
const obj = {
105104
target: this.dom,
@@ -129,12 +128,13 @@ class ScrollLink extends React.Component {
129128
render() {
130129
const active = this.state.active ? this.props.active : '';
131130
const onClick = this.props.onClick;
132-
const props = assign({}, this.props, {
131+
const props = {
132+
...this.props,
133133
onClick: (e) => {
134134
onClick(e);
135135
this.onClick(e);
136136
},
137-
});
137+
};
138138
[
139139
'component',
140140
'duration',

src/ScrollParallax.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import ReactDom from 'react-dom';
3-
import assign from 'object-assign';
43
import EventListener from './EventDispatcher';
54
import easingTypes from 'tween-functions';
65
import Timeline from 'rc-tween-one/lib/TimeLine';
@@ -76,9 +75,9 @@ class ScrollParallax extends React.Component {
7675
const vars = dataToArray(_vars);
7776
const varsForIn = (item, i) => {
7877
const playScale = playScaleToArray(item.playScale).map(data => data * this.clientHeight);
79-
const __item = assign({}, item);
78+
const __item = { ...item };
8079
delete __item.playScale;
81-
const _item = assign({}, item);
80+
const _item = { ...item };
8281
delete _item.playScale;
8382
_item.delay = __item.delay = playScale[0];
8483
_item.duration = __item.duration = playScale[1] - playScale[0];
@@ -153,13 +152,15 @@ class ScrollParallax extends React.Component {
153152
}
154153

155154
render() {
156-
const props = assign({}, this.props);
155+
const props = { ...this.props };
157156
[
158157
'animation',
159158
'always',
160159
'component',
160+
'location',
161+
'scrollName',
161162
].forEach(key => delete props[key]);
162-
const style = assign({}, props.style);
163+
const style = { ...props.style };
163164
for (const p in style) {
164165
if (p.indexOf('filter') >= 0 || p.indexOf('Filter') >= 0) {
165166
// ['Webkit', 'Moz', 'Ms', 'ms'].forEach(prefix=> style[`${prefix}Filter`] = style[p]);

0 commit comments

Comments
 (0)