diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index c598db6..3590eae 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -25,12 +25,7 @@ import { import type { ExtraInsets, Toast as ToastType } from '../core/types'; import { resolveValue, Toast as T, ToastPosition } from '../core/types'; -import { - colors, - ConstructShadow, - useKeyboard, - useVisibilityChange, -} from '../utils'; +import { colors, ConstructShadow, useVisibilityChange } from '../utils'; import { toast as toasting } from '../headless'; const AnimatedPressable = Animated.createAnimatedComponent(Pressable); @@ -48,6 +43,8 @@ type Props = { onToastHide?: (toast: T) => void; onToastPress?: (toast: T) => void; extraInsets?: ExtraInsets; + keyboardVisible?: boolean; + keyboardHeight: number; defaultStyle?: { pressable?: ViewStyle; view?: ViewStyle; @@ -68,10 +65,11 @@ export const Toast: FC = ({ onToastShow, extraInsets, defaultStyle, + keyboardVisible, + keyboardHeight, }) => { const insets = useSafeAreaInsets(); const { width, height } = useWindowDimensions(); - const { keyboardShown: keyboardVisible, keyboardHeight } = useKeyboard(); useVisibilityChange( () => { diff --git a/src/components/Toasts.tsx b/src/components/Toasts.tsx index 6ff719d..3ad33aa 100644 --- a/src/components/Toasts.tsx +++ b/src/components/Toasts.tsx @@ -6,6 +6,7 @@ import { Toast } from './Toast'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { ExtraInsets } from '../core/types'; import { useScreenReader } from 'src/core/utils'; +import { useKeyboard } from 'src/utils'; type Props = { overrideDarkMode?: boolean; @@ -37,6 +38,7 @@ export const Toasts: FunctionComponent = ({ const { startPause, endPause } = handlers; const insets = useSafeAreaInsets(); const isScreenReaderEnabled = useScreenReader(); + const { keyboardShown: keyboardVisible, keyboardHeight } = useKeyboard(); if (isScreenReaderEnabled && !preventScreenReaderFromHiding) { return null; @@ -69,6 +71,8 @@ export const Toasts: FunctionComponent = ({ onToastShow={onToastShow} extraInsets={extraInsets} defaultStyle={defaultStyle} + keyboardVisible={keyboardVisible} + keyboardHeight={keyboardHeight} /> ))}