Replies: 5 comments 16 replies
-
@gorhom |
Beta Was this translation helpful? Give feedback.
-
Hey can I take a look at your implementation? |
Beta Was this translation helpful? Give feedback.
-
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 😄 |
Beta Was this translation helpful? Give feedback.
-
#1510 Raised this PR to allow both View's and Scrollables to work with dynamic heights and to apply an optional maximum height. Hard to tell if @gorhom is still active on this library or not but if so please could you take a look? |
Beta Was this translation helpful? Give feedback.
-
Sorry I've been busy with my daily job, I'll have a look at it tomorrow 👍 |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions