Browse Source

Add SPRINT_CONFIG on FlipTicker

master
Loëck Vézien 7 years ago
parent
commit
16cb281102
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 7
      src/components/base/FlipTicker/index.js
  2. 2
      src/components/base/FlipTicker/stories.js

7
src/components/base/FlipTicker/index.js

@ -29,6 +29,11 @@ const TickWrapper = styled(Box).attrs({
const RANGE_NUMBER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
const RANGE_COMPONENT = RANGE_NUMBER.map((r, i) => <Box key={i}>{r}</Box>)
const SPRINT_CONFIG = {
stiffness: 280,
damping: 23,
}
type Props = {
value: string,
}
@ -94,7 +99,7 @@ function Tick(props: { height: number, value: string }) {
return (
<Motion
style={{
offset: spring(offset),
offset: spring(offset, SPRINT_CONFIG),
}}
>
{m => <TickWrapper offset={m.offset}>{RANGE_COMPONENT}</TickWrapper>}

2
src/components/base/FlipTicker/stories.js

@ -36,7 +36,7 @@ class Wrapper extends Component<any, any> {
value: getValue(),
})
this.generateValue()
}, 5000)
}, 1000)
render() {
const { render } = this.props

Loading…
Cancel
Save