Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(h5): 修复h5下onPullToRefresh缺少loading动画 #4114

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions packages/taro-components/src/components/pull-down-refresh/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,24 @@ class PullToRefresh extends Nerv.Component {
render={() => children} />
)

const renderRefresh = (cls) => {
const cla = classNames(cls, !this.state.dragOnEdge && `${prefixCls}-transition`)
const renderRefresh = cls => {
const { currSt, dragOnEdge } = this.state
const cla = classNames(cls, !dragOnEdge && `${prefixCls}-transition`)
const showIndicator = currSt === 'activate' || currSt === 'release'
return (
<div className={`${prefixCls}-content-wrapper`}>
<div className={cla} ref={el => {
this.contentRef = el
}}>
{/* <div className={`${prefixCls}-indicator`}>
{(indicator)[this.state.currSt] || (INDICATOR)[this.state.currSt]}
</div> */}
<div
className={cla}
ref={el => {
this.contentRef = el
}}>
{showIndicator && (
<div className={`${prefixCls}-indicator`}>
<div />
<div />
<div />
</div>
)}
{renderChildren}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,41 @@
transition: transform 0.3s;
}


@keyframes rmc-pull-to-refresh-indicator {
50% {
opacity: 0.2;
}
100% {
opacity: 1;
}
}

.rmc-pull-to-refresh-indicator {
color: grey;
text-align: center;
height: 25px;
line-height: 25px;
height: 30px;
line-height: 10px;
}

.rmc-pull-to-refresh-indicator > div {
background-color: grey;
width: 6px;
height: 6px;
border-radius: 100%;
margin: 3px;
animation-fill-mode: both;
display: inline-block;
animation: rmc-pull-to-refresh-indicator 0.5s 0s infinite linear;
}
.rmc-pull-to-refresh-indicator > div:nth-child(0) {
animation-delay: -0.1s !important;
}
.rmc-pull-to-refresh-indicator > div:nth-child(1) {
animation-delay: -0.2s !important;
}
.rmc-pull-to-refresh-indicator > div:nth-child(2) {
animation-delay: -0.3s !important;
}
.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator {
margin-top: -25px;
}
}