|
3 | 3 | */
|
4 | 4 | import React, { createElement } from 'react';
|
5 | 5 | import ReactDOM from 'react-dom';
|
6 |
| -import assign from 'object-assign'; |
7 | 6 | import easingTypes from 'tween-functions';
|
8 | 7 | import requestAnimationFrame from 'raf';
|
9 | 8 | import EventListener from './EventDispatcher';
|
@@ -53,7 +52,7 @@ class ScrollLink extends React.Component {
|
53 | 52 | this.scrollTop = currentScrollTop();
|
54 | 53 | const toTop = Math.round(elementRect.top) - Math.round(docRect.top);
|
55 | 54 | this.toTop = this.props.toShowHeight ?
|
56 |
| - toTop - transformArguments(this.props.showHeightActive)[0] : toTop; |
| 55 | + toTop - transformArguments(this.props.showHeightActive)[0] : toTop; |
57 | 56 | this.initTime = Date.now();
|
58 | 57 | this.rafID = requestAnimationFrame(this.raf);
|
59 | 58 | }
|
@@ -94,12 +93,12 @@ class ScrollLink extends React.Component {
|
94 | 93 | const top = Math.round(docRect.top - elementRect.top + scrollTop);
|
95 | 94 | const showHeightActive = transformArguments(this.props.showHeightActive);
|
96 | 95 | const startShowHeight = showHeightActive[0].toString().indexOf('%') >= 0 ?
|
97 |
| - parseFloat(showHeightActive[0]) / 100 * clientHeight : |
| 96 | + parseFloat(showHeightActive[0]) / 100 * clientHeight : |
98 | 97 | parseFloat(showHeightActive[0]);
|
99 | 98 | const endShowHeight = showHeightActive[1].toString().indexOf('%') >= 0 ?
|
100 |
| - parseFloat(showHeightActive[1]) / 100 * clientHeight : |
| 99 | + parseFloat(showHeightActive[1]) / 100 * clientHeight : |
101 | 100 | parseFloat(showHeightActive[1]);
|
102 |
| - if (top >= - startShowHeight && top < elementClientHeight - endShowHeight) { |
| 101 | + if (top >= -startShowHeight && top < elementClientHeight - endShowHeight) { |
103 | 102 | if (!this.props.onFocus.only) {
|
104 | 103 | const obj = {
|
105 | 104 | target: this.dom,
|
@@ -129,12 +128,13 @@ class ScrollLink extends React.Component {
|
129 | 128 | render() {
|
130 | 129 | const active = this.state.active ? this.props.active : '';
|
131 | 130 | const onClick = this.props.onClick;
|
132 |
| - const props = assign({}, this.props, { |
| 131 | + const props = { |
| 132 | + ...this.props, |
133 | 133 | onClick: (e) => {
|
134 | 134 | onClick(e);
|
135 | 135 | this.onClick(e);
|
136 | 136 | },
|
137 |
| - }); |
| 137 | + }; |
138 | 138 | [
|
139 | 139 | 'component',
|
140 | 140 | 'duration',
|
|
0 commit comments