Repository navigation
Replies: 5 comments 16 replies
|
@gorhom |
0 replies
|
Hey can I take a look at your implementation? |
5 replies
|
I found some problems with the solution in the linked PR when using this hook with dynamic content that changes before showing the bottom sheet. The solution I opted for is: // ....
const initialSnapPoints = useMemo(() => ["CONTENT_HEIGHT"], [])
const {
animatedHandleHeight,
animatedSnapPoints,
animatedContentHeight,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(initialSnapPoints)
const maxHeightStyle = useBottomSheetMaxHeight(maxHeight)
return (
<BottomSheetModal
// .... other props
snapPoints={animatedSnapPoints as any}
handleHeight={animatedHandleHeight}
contentHeight={animatedContentHeight}
>
<BottomSheetScrollView
onLayout={handleContentLayout}
style={{
maxHeight: maxHeightStyle,
}}
>
{children}
</BottomSheetScrollView>
</BottomSheetModal>
)
// ...With the custom /*
Designed to take the specified max height, take away top safe
area inset and convert to a decimal
*/
import { useWindowDimensions } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
export const useBottomSheetMaxHeight = (maxHeight = "85%"): number => {
const { height: deviceHeight } = useWindowDimensions()
const maxHeightDecimal = parseFloat(`${maxHeight}`) / 100.0
const { top: topSafeAreaInset } = useSafeAreaInsets()
return (deviceHeight - topSafeAreaInset) * maxHeightDecimal
}Hope that helps someone 😄 |
10 replies
|
Sorry I've been busy with my daily job, I'll have a look at it tomorrow 👍 |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello @gorhom,
Using your lib I was able to create a scrollable, dynamically size drawer that:
I hit a couple of road bumps on the development,
and i need your help to proceed with this idea.
Is it possible we will chat further on this ? This library helped us alot in our development,
and it seems its a long requested feature.
(#658 , #32)
Im finishing with a visual example of the described above behavior,
Simulator.Screen.Recording.-.iPhone.14.-.2023-05-10.at.11.06.14.mp4
Hope you liked it,
Please contact me so we can make this possible.
Email address: letscodetogether@skiff.com
All reactions