UNPKG

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

Version:
20 lines (19 loc) 879 B
"use strict"; import { Platform } from "react-native"; import { useDerivedValue } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useKeyboardHeightSharedValue } from "../context"; export function useKeyboardAwareSafeAreaBottomInset(fallbackInset) { const insets = useSafeAreaInsets(); const keyboardHeightSharedValue = useKeyboardHeightSharedValue(); return useDerivedValue(() => { switch (Platform.OS) { case "android": return insets.bottom + Math.min(keyboardHeightSharedValue.get(), fallbackInset); case "ios": return insets.bottom - Math.min(keyboardHeightSharedValue.get(), insets.bottom - fallbackInset); } return fallbackInset; }, [insets.bottom, keyboardHeightSharedValue, fallbackInset]); } //# sourceMappingURL=use-keyboard-aware-safe-area-bottom-inset.js.map