@attio/react-native-bottom-sheet-toolbox
Version:
19 lines (18 loc) • 725 B
JavaScript
;
import { useAnimatedReaction } from "react-native-reanimated";
import { useBottomSheetToolboxInternalContext } from "../context";
import { useBottomSheetActions } from "./use-bottom-sheet-actions";
export function useBottomSheetOpenWhenReady(initialSnapPointIndex) {
const {
isReadySharedValue
} = useBottomSheetToolboxInternalContext();
const {
snapToIndex
} = useBottomSheetActions("useBottomSheetOpenWhenReady");
useAnimatedReaction(() => isReadySharedValue.get(), (ready, lastReady) => {
if (!lastReady && ready && initialSnapPointIndex !== 0) {
snapToIndex(initialSnapPointIndex);
}
}, [isReadySharedValue]);
}
//# sourceMappingURL=use-bottom-sheet-open-when-ready.js.map