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

Commit

Permalink
zIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuke Shibata committed Nov 26, 2017
1 parent 62f2170 commit 9749b5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 3 additions & 1 deletion src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const dashed = keyframes`

const Component = styled.div`
position: absolute;
z-index: ${props => props.zIndex};
left: 50%;
border-radius: 20px;
width: 40px;
Expand All @@ -45,7 +46,7 @@ const DashedCircle = styled.circle`

export default (props, state, children) => {
const { max, yRefreshing, y, phase } = state
const { color, bgColor } = props
const { zIndex, color, bgColor } = props
const p = Math.atan(y / max)
const pMax = Math.atan(yRefreshing / max)
const r = Math.PI * 10 * 2
Expand All @@ -55,6 +56,7 @@ export default (props, state, children) => {
return [
<Component
key='pull'
zIndex={zIndex}
style={{
top: Math.max(refreshed ? Math.atan(1) : p, 0) * max - 10,
transform: `translate(-50%, -100%) scale(${refreshed ? p : 1},${refreshed ? p : 1})`,
Expand Down
32 changes: 15 additions & 17 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ export default class PullRefresh extends Component {
this._spring.onUpdate = ::this.onSpringUpdate
}
render() {
const { render, bgColor, color, onRefresh, disabled, as, children, ...props } = this.props
const {
zIndex,
render,
bgColor,
color,
onRefresh,
disabled,
as,
children,
...props
} = this.props
const Container = as
return (
<Container
Expand All @@ -116,14 +126,8 @@ PullRefresh.propTypes = {
disabled: PropTypes.bool,
color: PropTypes.string,
bgColor: PropTypes.string,
render: PropTypes.func
// max: PropTypes.number,
// offset: PropTypes.number,
// size: PropTypes.number,
// waitingComponent: PropTypes.oneOfType([ PropTypes.func, PropTypes.bool ]),
// pullingComponent: PropTypes.oneOfType([ PropTypes.func, PropTypes.bool ]),
// pulledComponent: PropTypes.oneOfType([ PropTypes.func, PropTypes.bool ]),
// supportDesktop: PropTypes.bool
render: PropTypes.func,
zIndex: PropTypes.number
}

PullRefresh.defaultProps = {
Expand All @@ -132,12 +136,6 @@ PullRefresh.defaultProps = {
disabled: false,
color: '#787878',
bgColor: '#fff',
render: renderDefault
// max: 100,
// offset: 0,
// size: 40,
// waitingComponent: undefined,
// pullingComponent: undefined,
// pulledComponent: undefined,
// supportDesktop: false
render: renderDefault,
zIndex: undefined
}

0 comments on commit 9749b5d

Please sign in to comment.