@nayan-ui/react-native
Version:
React Native Component Library for smooth and faster mobile application development.
49 lines (48 loc) • 1.28 kB
JavaScript
import React, { useCallback } from 'react';
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import { useNTheme } from "../hooks/useNTheme.js";
import { jsx as _jsx } from "react-native-css-interop/jsx-runtime";
export const NSheet = /*#__PURE__*/React.memo(({
sheetRef,
children,
snapPoints = null
}) => {
const {
colors
} = useNTheme();
const renderBackdrop = useCallback(props => _jsx(BottomSheetBackdrop, {
...props,
opacity: 0.6,
appearsOnIndex: 0,
disappearsOnIndex: -1,
pressBehavior: "close"
}), []);
return _jsx(BottomSheetModal, {
ref: sheetRef,
enablePanDownToClose: true,
enableDismissOnClose: true,
backdropComponent: renderBackdrop,
...(snapPoints && {
snapPoints,
enableDynamicSizing: false
}),
backgroundStyle: {
backgroundColor: colors.card
},
handleIndicatorStyle: {
backgroundColor: colors.muted
},
handleStyle: {
backgroundColor: colors.card,
borderTopLeftRadius: 10,
borderTopRightRadius: 10
},
children: _jsx(BottomSheetView, {
className: "flex-1",
children: children
})
});
});
NSheet.displayName = 'NSheet';
//# sourceMappingURL=NSheet.js.map
;