Skip to content

Instantly share code, notes, and snippets.

@Ramko9999
Created August 30, 2025 19:06
Show Gist options
  • Select an option

  • Save Ramko9999/d15f29a6c08b57a22e971b2b238ea4b3 to your computer and use it in GitHub Desktop.

Select an option

Save Ramko9999/d15f29a6c08b57a22e971b2b238ea4b3 to your computer and use it in GitHub Desktop.
type PopupBottomSheetModalProps = {
children: ReactNode;
header?: ReactNode;
}
export const PopupBottomSheetModal = forwardRef(
({ children, header }: PopupBottomSheetModalProps, ref: ForwardedRef<BottomSheetModal>) => {
const sheetColor = useThemeColoring("primaryViewBackground");
const textColor = useThemeColoring("primaryText");
const renderBackground = useCallback(
(props: BottomSheetBackgroundProps) => (
<View
{...props}
style={[
props.style,
{ backgroundColor: sheetColor },
popupBottomSheetStyles.background,
]}
/>
),
[sheetColor]
);
const renderBackdrop = useCallback(
(props: any) => (
<BottomSheetBackdrop
{...props}
disappearsOnIndex={-1}
appearsOnIndex={0}
opacity={0.5}
/>
),
[]
);
const renderHandle = useCallback(
(props: any) => (
<BottomSheetHandle
{...props}
style={[
props.style,
{
...popupBottomSheetStyles.handle,
},
]}
indicatorStyle={{
backgroundColor: textColor,
...popupBottomSheetStyles.indicator,
}}
>
{header}
</BottomSheetHandle>
),
[sheetColor, textColor, header]
);
return (
<BottomSheetModal
ref={ref}
backdropComponent={renderBackdrop}
handleComponent={renderHandle}
backgroundComponent={renderBackground}
>
<BottomSheetView
style={[
popupBottomSheetStyles.container,
{ backgroundColor: sheetColor },
]}
>
{children}
</BottomSheetView>
</BottomSheetModal>
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment