Closed mariovillamizar closed 2 years ago
Hey @webraptor & @mariovillamizar I have the exact same bug as you have!
hello guys, same issue here 😢
Unfortunately chances are this repo is not maintained either. Same error by the way, seems to come all the way back from the original repository
@DiegoBM if you fix the issue, please open a PR and it will be reviewed / merged. Thanks
For those of you who want to stick with this library, the problem is that the state values for "stackPositionN" and "stackScaleN" (N being the position number for each stack card) are not being reseted or recalculated upon stack re-renders. You can hack your way around it if you create a function that resets those specific state values before the call to "calculateStackCardZoomStyle", then it will work again as intended (Hint: you can use "rebuildStackAnimatedValues" as reference).
Hope it helps.
@DiegoBM can you create a pull request for this fix?
It worked for me by adding this function to the Swiper class in Swiper.js
rebuildStackValues = () => {
const stackPositionsAndScales = {}
const { stackSize, stackSeparation, stackScale } = this.props
for (let position = 0; position < stackSize; position++) {
stackPositionsAndScales[`stackPosition${position}`] = new Animated.Value(stackSeparation * position)
stackPositionsAndScales[`stackScale${position}`] = new Animated.Value((100 - stackScale * position) * 0.01)
}
return stackPositionsAndScales
}
and then setting the new state inside onSwipedCallbacks function
onSwipedCallbacks = (swipeDirectionCallback) => {
this.setState(this.rebuildStackValues) //<-- add this line
@webraptor i am edited a PR for this issue can u check it plz thanks ;)
for some reason I didn't get the notification back then.
pushed on npm as 2.0.6
Hey @webraptor thank you for your effort trying to keep this library alive. I found a weird bug where the stack stops animating (zooming the next cards) after swipe the first two cards. Take a look to this video: https://user-images.githubusercontent.com/10704258/132953264-65a11e59-19c2-4334-badb-e1a15bc662d7.mp4