Skip to content

Commit

Permalink
ensure correct positioning when using border styles (fixed #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbezhanov committed Nov 2, 2018
1 parent de6066e commit 27aacd3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/index.js
Expand Up @@ -200,9 +200,24 @@ export default class extends Component {
extrapolate: 'clamp'
})

const circlePosition = (value) => {
const modifier = value ? 1 : -1
let position = modifier * -1

if (circleStyle && circleStyle.borderWidth) {
position += modifier
}

if (style && style.borderWidth) {
position += modifier
}

return position
}

const interpolatedTranslateX = switchAnimation.interpolate({
inputRange: value ? [-this.offset, -1]: [1, this.offset],
outputRange: value ? [-this.offset, -1]: [1, this.offset],
outputRange: value ? [-this.offset, circlePosition(value)]: [circlePosition(value), this.offset],
extrapolate: 'clamp'
})

Expand Down

0 comments on commit 27aacd3

Please sign in to comment.