UNPKG

@attio/react-native-bottom-sheet-toolbox

Version:
23 lines (22 loc) 893 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useBottomSheetOpenWhenReady = useBottomSheetOpenWhenReady; var _reactNativeReanimated = require("react-native-reanimated"); var _context = require("../context"); var _useBottomSheetActions = require("./use-bottom-sheet-actions"); function useBottomSheetOpenWhenReady(initialSnapPointIndex) { const { isReadySharedValue } = (0, _context.useBottomSheetToolboxInternalContext)(); const { snapToIndex } = (0, _useBottomSheetActions.useBottomSheetActions)("useBottomSheetOpenWhenReady"); (0, _reactNativeReanimated.useAnimatedReaction)(() => isReadySharedValue.get(), (ready, lastReady) => { if (!lastReady && ready && initialSnapPointIndex !== 0) { snapToIndex(initialSnapPointIndex); } }, [isReadySharedValue]); } //# sourceMappingURL=use-bottom-sheet-open-when-ready.js.map