UNPKG

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

Version:
45 lines (44 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useBottomSheetDevToolsUpsertSheet = useBottomSheetDevToolsUpsertSheet; var _react = _interopRequireDefault(require("react")); var _reactNativeReanimated = require("react-native-reanimated"); var _context = require("../../context"); var _utils = require("../../utils"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function useBottomSheetDevToolsUpsertSheet() { const { currentPositionSharedValue, normalizedSnapPointsSharedValue, wrapperHeightSharedValue, isReadySharedValue, debugId } = (0, _context.useBottomSheetToolboxInternalContext)(); const sendSheetMessage = _react.default.useCallback(payload => { _utils.BOTTOM_SHEET_DEV_TOOLS.sendMessage("upsert-sheet", { ...payload, sheetId: debugId }); }, [debugId]); (0, _reactNativeReanimated.useAnimatedReaction)(() => ({ currentPosition: currentPositionSharedValue.get(), snapPoints: normalizedSnapPointsSharedValue.get(), wrapperHeight: wrapperHeightSharedValue.get(), isReady: isReadySharedValue.get() }), ({ currentPosition, snapPoints, wrapperHeight, isReady }) => { (0, _reactNativeReanimated.runOnJS)(sendSheetMessage)({ currentPosition, snapPoints, wrapperHeight, isReady }); }, [currentPositionSharedValue, normalizedSnapPointsSharedValue, wrapperHeightSharedValue, isReadySharedValue]); } //# sourceMappingURL=use-bottom-sheet-dev-tools-upsert-sheet.js.map