fix: KeyboardAvoidingView
with secureTextEntry
#331
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
馃摐 Description
Fixed choppy animation for
KeyboardAvoidingView
if childTextInputs
are usingsecureTextEntry
property.馃挕 Motivation and Context
The problem which causes jumpy behavior is hidden in fact, that 2
keyboardWillShow
+keyboardWillHide
events are emitted instead of a single one. If we add logger we'll see:And such events are very similar to what happens on Android when keyboard gets resized. So basically fix consist from two parts.
Part 1锔忊儯
In
useKeyboardInterpolation
we are not using Android specific interpolation and are using "progress"-based animation (interpolation between current keyboard frame and final keyboard frame). It allows us to have positive value and make animation smooth. However is some cases we may see a jump occurring for one frame, and for that we apply second fix.Part 2锔忊儯
In second part we are handling "unnecessary"
onEnd
event. Before we were simply updatingheight
/progress
values inonEnd
handler - it was needed to handle cases whenonMove
handler is not called but we still need to synchronize the state.In this PR I slightly re-worked approach and now I'm updating it only if
duration === 0
(i. e. transition was instant).Closes #327
馃摙 Changelog
JS
useKeyboardInterpolation
;onEnd
only ifduration
is0
.馃 How Has This Been Tested?
Tested on iPhone 15 Pro.
馃摳 Screenshots (if appropriate):
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-01-12.at.23.15.49.mp4
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-01-12.at.23.13.11.mp4
馃摑 Checklist