react-native-flip-card icon indicating copy to clipboard operation
react-native-flip-card copied to clipboard

How do you specify the duration of the animation flip?

Open gianpaj opened this issue 7 years ago • 2 comments

Thanks for putting this component together!

If you can even show me where to add this prop I'll be happy to send a pull request. Thanks

gianpaj avatar Jan 12 '18 20:01 gianpaj

not possible in this version. try to copy and past out of node_module. and add the props manually like so: if FlipCard line 50 Animated.spring(this.state.rotate, { toValue: Number(isFlipped), tension: this.props.tension, friction: this.props.friction, useNativeDriver: this.props.useNativeDriver }

mr-piratman avatar Jan 31 '18 09:01 mr-piratman

spring animation doesnt get duration. You can change the aniamtion to Animated.timing as follows: Animated.timing(this.state.rotate, { toValue: Number(isFlipped), duration:this.props.duration, useNativeDriver: this.props.useNativeDriver } ).start((param) => { this.setState({isFlipping: false}) this.props.onFlipEnd(this.state.isFlipped) }) }

*If you'd like to use long duration (longer than 1000) you may need to animate content change as well, as theyre now changed once you click on the card. you can do it by changing the fipping time to half of the duration, e.g. if your duration is 1000, then the flipping should be 500, _animation (isFlipped) { if (!this.timer) { this.timer = setTimeout(() => { this.setState({isFlipped: !this.state.isFlipped}) this.timer = null }, 500) } You can set this value manually if all of your Flliping card behave the same.

just make sure you extends your node modules, otherwise, you'd lose the change when you remove and install node modules again. Hope it helps

kevinNejad avatar Mar 02 '18 19:03 kevinNejad