@attio/react-native-bottom-sheet-toolbox
Version:
27 lines (26 loc) • 1.09 kB
JavaScript
;
import React from "react";
import { useBottomSheetToolboxInternalContext } from "../../context";
import { BOTTOM_SHEET_DEV_TOOLS } from "../../utils";
export function useBottomSheetDevToolsInitialSheet() {
const {
currentPositionSharedValue,
normalizedSnapPointsSharedValue,
wrapperHeightSharedValue,
isReadySharedValue,
debugId
} = useBottomSheetToolboxInternalContext();
const sendSheetMessage = React.useCallback(() => {
BOTTOM_SHEET_DEV_TOOLS.sendMessage("upsert-sheet", {
currentPosition: currentPositionSharedValue.get(),
snapPoints: normalizedSnapPointsSharedValue.get(),
wrapperHeight: wrapperHeightSharedValue.get(),
isReady: isReadySharedValue.get(),
sheetId: debugId
});
}, [currentPositionSharedValue, debugId, isReadySharedValue, normalizedSnapPointsSharedValue, wrapperHeightSharedValue]);
React.useEffect(() => {
BOTTOM_SHEET_DEV_TOOLS.addMessageListener("did-connect", sendSheetMessage);
}, [sendSheetMessage]);
}
//# sourceMappingURL=use-bottom-sheet-dev-tools-initial-sheet.js.map