From f18e223e988ec0c7147c10ce2563c70ef0eaf61f Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Sun, 14 Jan 2024 15:54:06 +0100 Subject: [PATCH] fix: update in `onEnd` only in instant transitions --- src/components/KeyboardAvoidingView/hooks.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/KeyboardAvoidingView/hooks.ts b/src/components/KeyboardAvoidingView/hooks.ts index a7fa06a95..162983058 100644 --- a/src/components/KeyboardAvoidingView/hooks.ts +++ b/src/components/KeyboardAvoidingView/hooks.ts @@ -29,8 +29,14 @@ export const useKeyboardAnimation = () => { isClosed.value = e.height === 0; - progress.value = e.progress; - height.value = e.height; + // update value only if transition was instant + // otherwise update will happen in `onMove` handler + // this `if` condition is needed to handle `secureTextEntry` + // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327 + if (e.duration === 0) { + progress.value = e.progress; + height.value = e.height; + } }, }, [],