@ozen-ui/kit
Version:
React component library
46 lines (45 loc) • 1.07 kB
JavaScript
import { createContext, useContext } from 'react';
import { isDev } from '../../../constants/environment';
export var BottomSheetBaseContext = createContext({
rootRef: {
current: null,
},
scrollRef: {
current: null,
},
contentRef: {
current: null,
},
blocksRefs: {
current: {},
},
minSnap: 0,
maxSnap: 0,
defaultSnap: 0,
snaps: [],
onClose: function () { },
isClosable: false,
canDrag: {
current: true,
},
snapsControl: {
point: {
current: 0,
},
to: function () { },
toDefault: function () { },
toClosed: function () { },
toAnimated: function () { },
},
findClosestSnap: {
current: function () { return 0; },
},
addBlockRef: function () { },
});
export var useBottomSheetBaseContext = function () {
return useContext(BottomSheetBaseContext);
};
// Именованный провайдер
if (isDev) {
BottomSheetBaseContext.displayName = 'BottomSheetBaseContext';
}