Skip to content

Commit

Permalink
fix: reduce motion on iOS 14 breaks KeyboardAvoidingView
Browse files Browse the repository at this point in the history
With iOS 14 & Reduce Motion > Prefer Cross-Fade Transitions enabled, the keyboard position
& height is reported differently (0 instead of Y position value matching height of frame).
See: facebook#29974 (comment)

This commit implements the fix mentioned in the link above.
  • Loading branch information
BrandonYuen authored and tjespers committed Jul 27, 2022
1 parent 72e1eda commit 8a1f6c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Libraries/Components/Keyboard/KeyboardAvoidingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class KeyboardAvoidingView extends React.Component<Props, State> {

_relativeKeyboardHeight(keyboardFrame: KeyboardEventCoordinates): number {
const frame = this._frame;
if (!frame || !keyboardFrame) {
// with iOS 14 & Reduce Motion > Prefer Cross-Fade Transitions enabled, the keyboard position
// & height is reported differently (0 instead of Y position value matching height of frame)
if (!frame || !keyboardFrame || keyboardFrame.screenY === 0) {
return 0;
}

Expand Down

0 comments on commit 8a1f6c8

Please sign in to comment.