UNPKG

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

Version:
40 lines (39 loc) 1.28 kB
"use strict"; import React from "react"; import { runOnJS, useAnimatedReaction } from "react-native-reanimated"; import { useBottomSheetToolboxInternalContext } from "../../context"; import { BOTTOM_SHEET_DEV_TOOLS } from "../../utils"; export function useBottomSheetDevToolsUpsertSheet() { const { currentPositionSharedValue, normalizedSnapPointsSharedValue, wrapperHeightSharedValue, isReadySharedValue, debugId } = useBottomSheetToolboxInternalContext(); const sendSheetMessage = React.useCallback(payload => { BOTTOM_SHEET_DEV_TOOLS.sendMessage("upsert-sheet", { ...payload, sheetId: debugId }); }, [debugId]); useAnimatedReaction(() => ({ currentPosition: currentPositionSharedValue.get(), snapPoints: normalizedSnapPointsSharedValue.get(), wrapperHeight: wrapperHeightSharedValue.get(), isReady: isReadySharedValue.get() }), ({ currentPosition, snapPoints, wrapperHeight, isReady }) => { runOnJS(sendSheetMessage)({ currentPosition, snapPoints, wrapperHeight, isReady }); }, [currentPositionSharedValue, normalizedSnapPointsSharedValue, wrapperHeightSharedValue, isReadySharedValue]); } //# sourceMappingURL=use-bottom-sheet-dev-tools-upsert-sheet.js.map