Closed nickbyte closed 1 year ago
you have this handler on props
onSnap={snapIndex => console.log('> Current snap point index:', snapIndex) }
is the index from snapPoints array
snapPoints={[600, 400, 100, 0]}
initialSnap={1}
@nickbyte can you provide a repro of this issue in CodeSandbox? Or did you figure it out?
Your problem might be related to you changing the container height which will probably mess with the snap point calculations within the library 🤔
I have the same problem. It gives a valid snapoint index on load but after dragging, it always gives -1.
@Temzasse I found the issue:
I was using your example from
https://github.com/Temzasse/react-modal-sheet/blob/master/example/components/SnapPoints.tsx
but if you change the snapPoints all to percentages like:
const snapPoints = [0.9, 0.6, 0.3, 0];
And just appear when dragging in responsive view codesandbox
I am having the same problem, I used the following props <Sheet snapPoints={[0.925, 0.53, 0.19]} initialSnap={2} onSnap={(snapIndex) => { console.log(snapIndex); }} .../>
but it is giving the actual snap index on load only. Otherwise, it returns -1. is there any way I can get the current snap index?
I am trying to adjust the wrapping container height based on which is the active current point, onSnap, returns negative values. So hard to identify which is the active snap