-
-
Notifications
You must be signed in to change notification settings - Fork 768
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
Eli nathan/dynamic size bottom sheet with max height #1510
Eli nathan/dynamic size bottom sheet with max height #1510
Conversation
May the odds be in your favour ! |
feat: rap content in view
@@ -0,0 +1,39 @@ | |||
import { useWindowDimensions } from 'react-native'; | |||
import { useSafeAreaInsets } from 'react-native-safe-area-context'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use internal container height instead using react-native-safe-area-context
library ?
first, thanks @ororsatti for submitting the initial PR, i do apologies for not reviewing it on time , your contribution is appreciated. second, @Eli-Nathan i left a comment about the usage of |
Thanks so much! |
@gorhom examples with and without safe area when modal provider wraps the whole app 😄
|
I have already expose the container height const { animatedContainerHeight } = useBottomSheetInternal(true); |
hmmm ,, let me think of a different approach .. my main concern is now we are adding another hard dependency to the project which is something i try to avoid |
i was thinking about this for a while now, what if we moved the while dynamic sizing internally , where users do not need to do anything 🧐 , except using a view from the library ( scrollable or just static view ) |
Edit: Ah wait it works without the boolean... |
Hmm, would that still allow them to specify a maxHeight though? |
we could introduce a prop for max snap point to address that issue, so users who wants dynamic size they will need to provide two props:
with this, we will remove the dynamic hook and remove handling layout complexity |
So we'd be applying these styles to I've had a look at that component and it's very complex. What are your thoughts on doing applying this as a solution for V4 and the enableDynamicSizing solution for V5 since it seems like it'd be a much bigger refactor? |
no, i would apply it to the content container and scrollables
mm i think the code should be sharable with v5 if we do it correctly for v4. im going to draft something as a poc and get back to you |
Sounds good! Thanks again! |
First of all, I'm so glad to hear from you, I thought this lib is going to dei down slowly, |
@ororsatti Count me in, this has been hugely valuable to me in multiple projects so happy to help where I can |
@Eli-Nathan @ororsatti managed to get dynamic sizing by prop working with View with the approach i suggested , going to apply it on scrollables and i'll prepare a draft PR by tomorrow |
closing this PR in favour of #1513, which it has been merged. Thanks @Eli-Nathan |
Inspired by #1402 @ororsatti
Adding a hook to have a sheet with a max height that will dynamically change its height until reaching the limit, following this discussion: #1363
useBottomSheetMaxHeight
hookuseBottomSheetDynamicSnapPoints
Motivation
People are asking for this feature for a while now, and asked me in the discussion to share the code.
Closes: (#658 , #32)
Example
Screen.Recording.2023-09-08.at.18.38.42.mov