@@ -23,7 +23,6 @@ import type {
23
23
ViewLayoutEvent ,
24
24
} from '../View/ViewPropTypes' ;
25
25
import type { KeyboardEvent , KeyboardEventCoordinates } from './Keyboard' ;
26
- import AccessibilityInfo from '../AccessibilityInfo/AccessibilityInfo' ;
27
26
28
27
type Props = $ReadOnly < { |
29
28
...ViewProps ,
@@ -72,24 +71,12 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
72
71
this . viewRef = React . createRef ( ) ;
73
72
}
74
73
75
- async _relativeKeyboardHeight (
76
- keyboardFrame : KeyboardEventCoordinates ,
77
- ) : Promise < number > {
74
+ _relativeKeyboardHeight ( keyboardFrame : KeyboardEventCoordinates ) : number {
78
75
const frame = this . _frame ;
79
76
if ( ! frame || ! keyboardFrame ) {
80
77
return 0 ;
81
78
}
82
79
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
-
93
80
const keyboardY =
94
81
keyboardFrame . screenY - ( this . props . keyboardVerticalOffset ?? 0 ) ;
95
82
@@ -103,7 +90,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
103
90
this . _updateBottomIfNecessary ( ) ;
104
91
} ;
105
92
106
- _onLayout = async ( event : ViewLayoutEvent ) => {
93
+ _onLayout = ( event : ViewLayoutEvent ) => {
107
94
const wasFrameNull = this . _frame == null ;
108
95
this . _frame = event . nativeEvent . layout ;
109
96
if ( ! this . _initialFrameHeight ) {
@@ -112,22 +99,22 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
112
99
}
113
100
114
101
if ( wasFrameNull ) {
115
- await this . _updateBottomIfNecessary ( ) ;
102
+ this . _updateBottomIfNecessary ( ) ;
116
103
}
117
104
118
105
if ( this . props . onLayout ) {
119
106
this . props . onLayout ( event ) ;
120
107
}
121
108
} ;
122
109
123
- _updateBottomIfNecessary = async ( ) => {
110
+ _updateBottomIfNecessary = ( ) => {
124
111
if ( this . _keyboardEvent == null ) {
125
112
this . setState ( { bottom : 0 } ) ;
126
113
return ;
127
114
}
128
115
129
116
const { duration, easing, endCoordinates} = this . _keyboardEvent ;
130
- const height = await this . _relativeKeyboardHeight ( endCoordinates ) ;
117
+ const height = this . _relativeKeyboardHeight ( endCoordinates ) ;
131
118
132
119
if ( this . state . bottom === height ) {
133
120
return ;
0 commit comments