Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible dynamic snap add point ? #46

Open
behnam-maqsudi opened this issue Sep 4, 2021 · 4 comments
Open

is it possible dynamic snap add point ? #46

behnam-maqsudi opened this issue Sep 4, 2021 · 4 comments

Comments

@behnam-maqsudi
Copy link

behnam-maqsudi commented Sep 4, 2021

how can i make dynamic size ?

image

image

and I found another issue !
when I set snap points like [0.9, 0.3,0] on Snap method not called correctly and return -1 or not called

please check this issue

@Temzasse
Copy link
Owner

Hi @benamm👋

Can you describe your use case for the dynamic snap point in more detail? How should it work from your perspective?

I'll try to take a look at the snap point issue you mentioned when I have some free time to work on this project 🙂

@shivamragnar
Copy link

Hey @Temzasse, I have a similar dynamic snap points use case. So i have two sets of snap points, which i pass as a prop using conditional operators, but i don't get the same animation as I would have got if the snap points were in same array.

Why I don't want these snap points in same array is because, when on a lower snap point, i do not want the sheet to go to a higher snap point. I wish if there was some way, where i can have the same animation as i get while switching snap points in my case where i am changing snap points array based on a condition.
Here is an example

<TheSheet
    isOpen={isOpen || isSending}
    initialSnap={initialSnap}
    onClose={onCloseOfSheet}
    disableDrag={disableDrag}
    snapPoints={ [heighestSnapPoint, 340, 0] }
 >
<TheSheet
   isOpen={isOpen || isSending}
   initialSnap={initialSnap}
   onClose={onCloseOfSheet}
   disableDrag={disableDrag}
   snapPoints={selectedUser.length ? [340, 0] : [heighestSnapPoint, 0]}
>

@Temzasse
Copy link
Owner

What would be the expected result when the snap points array is dynamically changed? Should it animate to the snap point that exists in at the current active snap point index 🤔 What if the new array has less snap points than the previous one?

@shivamragnar
Copy link

The expected use cases are, say there are two pages in a sheet and both the pages have different set of snap points. For them to be used in the same sheet,

  • When the second UI is shown based on a boolean condition, it should snap to it's set of snap points.

  • Now to do that, there can be two solutions
    -> Give all the snap points in a single array and switch them according to which UI is rendered.
    -> Provide separate set of snap point arrays and switch between those arrays based on the which UI is rendered.

    The issue with first is
    -> We can't disable other snap points which are no more required, sheet can still use those snap points
    The second solution has
    -> No animation when the snap point array is changed. Like when for first time the sheet opens or when snap point changes
    from a single array, that kind of animation is not there in the sheet.

I hope this explanation helps @Temzasse :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants