Created
August 30, 2025 19:06
-
-
Save Ramko9999/d15f29a6c08b57a22e971b2b238ea4b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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