Skip to content

Commit 5dad02a

Browse files
authored
Do not animate layout if keyboard state is not changed
Andr3wHur5t#66 I've found that closing a modal cause keyboard to open and then immediately hide, which causes multiple calls of resetKeyboardSpace function, and this causes an error: Warning: Overriding previous layout animation Which affects Modal somehow, because it could not be hidden after this warning.
1 parent b380a16 commit 5dad02a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

KeyboardSpacer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class KeyboardSpacer extends Component {
8686
}
8787

8888
updateKeyboardSpace(event) {
89-
if (!event.endCoordinates) {
89+
if (!event.endCoordinates || this.state.isKeyboardOpened) {
9090
return;
9191
}
9292

@@ -113,6 +113,10 @@ export default class KeyboardSpacer extends Component {
113113
}
114114

115115
resetKeyboardSpace(event) {
116+
if (!this.state.isKeyboardOpened) {
117+
return;
118+
}
119+
116120
let animationConfig = defaultAnimation;
117121
if (Platform.OS === 'ios') {
118122
animationConfig = LayoutAnimation.create(

0 commit comments

Comments
 (0)