Skip to content

Commit

Permalink
fix link
Browse files Browse the repository at this point in the history
  • Loading branch information
jljsj33 committed Jul 25, 2018
1 parent c85da11 commit 9bdc5d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "rc-scroll-anim",
"version": "2.5.4",
"version": "2.5.5",
"description": "scroll-anim anim component for react",
"keywords": [
"react",
Expand Down
6 changes: 3 additions & 3 deletions src/ScrollLink.jsx
Expand Up @@ -89,18 +89,18 @@ class ScrollLink extends React.Component {
toTop - toShow + 0.5 : toTop;
this.initTime = Date.now();
this.rafID = requestAnimationFrame(this.raf);
/* scrollLinkLists.forEach(item => {
scrollLinkLists.forEach(item => {
if (item !== this) {
item.remActive();
}
});
this.addActive(); */
this.addActive();
}

getElement = () => {
this.clientHeight = this.target ? this.target.clientHeight : windowHeight();
const elementDom = document.getElementById(this.props.to);
const elementRect = elementDom.getBoundingClientRect();
const elementRect = elementDom && elementDom.getBoundingClientRect();
return { elementDom, elementRect };
}

Expand Down
10 changes: 6 additions & 4 deletions src/ScrollOverPack.jsx
Expand Up @@ -105,10 +105,11 @@ class ScrollOverPack extends ScrollElement {
if (!item) {
return null;
}
const key = item.key || (Date.now() + Math.random()).toString(16).replace('.', '');
return (
item.type.isTweenOne ?
React.cloneElement(item, { ...item.props, paused: !show }) :
React.cloneElement(item, item.props, show && item.props.children)
React.cloneElement(item, { ...item.props, key, paused: !show }) :
React.cloneElement(item, { ...item.props, key }, show && item.props.children)
);
});
childToRender = createElement(component, { ...props, ...componentProps }, children);
Expand All @@ -119,11 +120,12 @@ class ScrollOverPack extends ScrollElement {
if (!item) {
return null;
}
const key = item.key || (Date.now() + Math.random()).toString(16).replace('.', '');
// 判断 TweenOne;
if (item.type.isTweenOne) {
return React.cloneElement(item, { reverse: true });
return React.cloneElement(item, { key, reverse: true });
}
return React.cloneElement(item, {}, null);
return React.cloneElement(item, { key }, null);
});
} else {
this.children = this.state.children;
Expand Down

0 comments on commit 9bdc5d6

Please sign in to comment.