Skip to content

Commit

Permalink
fix: update isKeyboardVisible in onEnd callback (#145)
Browse files Browse the repository at this point in the history
## 📜 Description

Update class member `isKeyboardVisible` field in `onEnd` lifecycle
instead of creating a new local variable.

## 💡 Motivation and Context

Since `onEnd` may have a different state of `isKeyboardVisible`, we need
to update a class variable instead of creating a new local variable,
since otherwise the state may be unsynchronised which can lead to
different issues.

These changes shouldn't introduce any new problem, since
`isKeyboardVisible` is getting updated in `onStart` callback and in
`onEnd` most of the time it will have the same value as in `onStart`.

Fixes:
#144

## 📢 Changelog

### Android
- update `isKeyboardVisible` in `onEnd` callback;

## 🤔 How Has This Been Tested?

Tested on:
- Pixel 3a (Android 13, emulator);
- Pixel 7 Pro (Android 13, real device).

## 📸 Screenshots (if appropriate):


https://user-images.githubusercontent.com/22820318/232770424-8e70995a-72f9-4d4b-a3d4-07054e25a632.mp4

## 📝 Checklist

- [x] CI successfully passed
  • Loading branch information
kirillzyusko authored Apr 18, 2023
1 parent b1192a2 commit cba4746
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class KeyboardAnimationCallback(
// then we need to reset the state
InteractiveKeyboardProvider.shown = false
}
val isKeyboardVisible = isKeyboardVisible || isKeyboardShown
isKeyboardVisible = isKeyboardVisible || isKeyboardShown

this.emitEvent("KeyboardController::" + if (!isKeyboardVisible) "keyboardDidHide" else "keyboardDidShow", getEventParams(this.persistentKeyboardHeight))
this.sendEventToJS(KeyboardTransitionEvent(view.id, "topKeyboardMoveEnd", this.persistentKeyboardHeight, if (!isKeyboardVisible) 0.0 else 1.0))
Expand Down

0 comments on commit cba4746

Please sign in to comment.