Skip to content

Commit

Permalink
fix: update in onEnd only in instant transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jan 14, 2024
1 parent 4280bbe commit f18e223
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/KeyboardAvoidingView/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
},
[],
Expand Down

0 comments on commit f18e223

Please sign in to comment.