From 8aee112d464f144ef3a286585b2123489700d903 Mon Sep 17 00:00:00 2001 From: Rami Elwan Date: Tue, 12 Aug 2025 13:26:11 +0200 Subject: [PATCH] fix: fix disabling KeyboardAvoidingView --- src/components/KeyboardAvoidingView/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index c29e9e7b5d..ba162c29d0 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -139,13 +139,16 @@ const KeyboardAvoidingView = forwardRef< ); const animatedStyle = useAnimatedStyle(() => { + if (!enabled) { + return {}; + } + const bottom = interpolateToRelativeKeyboardHeight( keyboard.progress.value, ); const translateY = interpolateToRelativeKeyboardHeight(translate.value); const paddingBottom = interpolateToRelativeKeyboardHeight(padding.value); - const bottomHeight = enabled ? bottom : 0; - const height = frame.value.height - bottomHeight; + const height = frame.value.height - bottom; switch (behavior) { case "height": @@ -159,10 +162,10 @@ const KeyboardAvoidingView = forwardRef< return {}; case "position": - return { bottom: bottomHeight }; + return { bottom }; case "padding": - return { paddingBottom: bottomHeight }; + return { paddingBottom: bottom }; case "translate-with-padding": return {