Skip to content
This repository has been archived by the owner on Nov 27, 2021. It is now read-only.

Commit

Permalink
fix for position
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuke Shibata committed Dec 19, 2017
1 parent 59c5fd6 commit 9cf0e5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
9 changes: 4 additions & 5 deletions src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DashedCircle = styled.circle`
animation: ${dashed} 1.4s ease-in-out infinite;
`

export default (props, state, children) => {
export default (props, state) => {
const { max, yRefreshing, y, phase } = state
const { zIndex, color, bgColor } = props
const p = Math.atan(y / max)
Expand All @@ -53,7 +53,7 @@ export default (props, state, children) => {
const Svg = phase === 'refreshing' ? RotatingSvg : 'svg'
const Circle = phase === 'refreshing' ? DashedCircle : 'circle'
const refreshed = phase === 'refreshed'
return [
return (
<Component
key='pull'
zIndex={zIndex}
Expand Down Expand Up @@ -94,9 +94,8 @@ export default (props, state, children) => {
/>
}
</Svg>
</Component>,
children
]
</Component>
)
}


30 changes: 17 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,25 @@ export default class PullRefresh extends Component {
children,
...props
} = this.props
const PullRefreshComponent = render
const Container = as
return (
<Container
ref='container'
{...props}
onScroll ={!disabled && ::this.onScroll}
onMouseDown ={!disabled && ::this.onDown}
onMouseUp ={!disabled && ::this.onUp}
onMouseMove ={!disabled && ::this.onMove}
onTouchStart={!disabled && ::this.onDown}
onTouchEnd ={!disabled && ::this.onUp}
onTouchMove ={!disabled && ::this.onMove}
>
{ render(this.props, this.state, children) }
</Container>
<div>
<Container
ref='container'
{...props}
onScroll ={!disabled && ::this.onScroll}
onMouseDown ={!disabled && ::this.onDown}
onMouseUp ={!disabled && ::this.onUp}
onMouseMove ={!disabled && ::this.onMove}
onTouchStart={!disabled && ::this.onDown}
onTouchEnd ={!disabled && ::this.onUp}
onTouchMove ={!disabled && ::this.onMove}
>
{ children }
</Container>
{ render(this.props, this.state) }
</div>
)
}
}
Expand Down

0 comments on commit 9cf0e5c

Please sign in to comment.