octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
929 stars 157 forks source link

Updating draggableRange stops drag #74

Closed iamjohnpeet closed 5 years ago

iamjohnpeet commented 6 years ago

I have created a Panel component that accepts a prop called panelHeight. This is set in the parent screen component and changes depending on the state (the height starts at 110 and when the state changes it is 210).

When the height is updated I transition to the new height (this works fine) and update the bottom property of the draggableRange to match the height but I can no longer drag the panel. I have a click on the visible panel that opens the panel full height, once this is selected the drag is available again. If the heights are exactly the same then there is no issue. Also if the height is reduced, 210 > 110, instead of increased then the drag still works fine.

santiagomartinez commented 5 years ago

Had the same problem. Solved it by adding if(this._isAtBottom && this._animatedValueY > -bottom){ this._animatedValueY = -bottom }

in function componentWillReceiveProps before this._flick = new FlickAnimation(this._translateYAnimation, -top, -bottom)

Please consider that this may be an incomplete solution. In my case the panel is closed when the bottom property is updated.

octopitus commented 5 years ago

Addressed your issue in v2.