Skip to content

Commit 9fd7643

Browse files
committed
Revert "fix: KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled (#34503)"
This reverts commit ec0049b.
1 parent a54ba33 commit 9fd7643

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

Libraries/Components/Keyboard/KeyboardAvoidingView.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import type {
2323
ViewLayoutEvent,
2424
} from '../View/ViewPropTypes';
2525
import type {KeyboardEvent, KeyboardEventCoordinates} from './Keyboard';
26-
import AccessibilityInfo from '../AccessibilityInfo/AccessibilityInfo';
2726

2827
type Props = $ReadOnly<{|
2928
...ViewProps,
@@ -72,24 +71,12 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
7271
this.viewRef = React.createRef();
7372
}
7473

75-
async _relativeKeyboardHeight(
76-
keyboardFrame: KeyboardEventCoordinates,
77-
): Promise<number> {
74+
_relativeKeyboardHeight(keyboardFrame: KeyboardEventCoordinates): number {
7875
const frame = this._frame;
7976
if (!frame || !keyboardFrame) {
8077
return 0;
8178
}
8279

83-
// On iOS when Prefer Cross-Fade Transitions is enabled, the keyboard position
84-
// & height is reported differently (0 instead of Y position value matching height of frame)
85-
if (
86-
Platform.OS === 'ios' &&
87-
keyboardFrame.screenY === 0 &&
88-
(await AccessibilityInfo.prefersCrossFadeTransitions())
89-
) {
90-
return 0;
91-
}
92-
9380
const keyboardY =
9481
keyboardFrame.screenY - (this.props.keyboardVerticalOffset ?? 0);
9582

@@ -103,7 +90,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
10390
this._updateBottomIfNecessary();
10491
};
10592

106-
_onLayout = async (event: ViewLayoutEvent) => {
93+
_onLayout = (event: ViewLayoutEvent) => {
10794
const wasFrameNull = this._frame == null;
10895
this._frame = event.nativeEvent.layout;
10996
if (!this._initialFrameHeight) {
@@ -112,22 +99,22 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
11299
}
113100

114101
if (wasFrameNull) {
115-
await this._updateBottomIfNecessary();
102+
this._updateBottomIfNecessary();
116103
}
117104

118105
if (this.props.onLayout) {
119106
this.props.onLayout(event);
120107
}
121108
};
122109

123-
_updateBottomIfNecessary = async () => {
110+
_updateBottomIfNecessary = () => {
124111
if (this._keyboardEvent == null) {
125112
this.setState({bottom: 0});
126113
return;
127114
}
128115

129116
const {duration, easing, endCoordinates} = this._keyboardEvent;
130-
const height = await this._relativeKeyboardHeight(endCoordinates);
117+
const height = this._relativeKeyboardHeight(endCoordinates);
131118

132119
if (this.state.bottom === height) {
133120
return;

0 commit comments

Comments
 (0)