GithubHelp home page GithubHelp logo

Comments (6)

Guiw5 avatar Guiw5 commented on May 27, 2024

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}

from react-modal-sheet.

Temzasse avatar Temzasse commented on May 27, 2024

@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 🤔

from react-modal-sheet.

slellampati avatar slellampati commented on May 27, 2024

I have the same problem. It gives a valid snapoint index on load but after dragging, it always gives -1.

from react-modal-sheet.

Guiw5 avatar Guiw5 commented on May 27, 2024

@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

from react-modal-sheet.

AbBiz21 avatar AbBiz21 commented on May 27, 2024

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?

from react-modal-sheet.

Temzasse avatar Temzasse commented on May 27, 2024

Thanks for reporting this 🙏🏻 This should be fixed in version 1.6.1 🙂

from react-modal-sheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.