Skip to content

Commit

Permalink
Do not animate layout if keyboard state is not changed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SnaiNeR authored Jun 10, 2020
1 parent b380a16 commit 5dad02a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion KeyboardSpacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class KeyboardSpacer extends Component {
}

updateKeyboardSpace(event) {
if (!event.endCoordinates) {
if (!event.endCoordinates || this.state.isKeyboardOpened) {
return;
}

Expand All @@ -113,6 +113,10 @@ export default class KeyboardSpacer extends Component {
}

resetKeyboardSpace(event) {
if (!this.state.isKeyboardOpened) {
return;
}

let animationConfig = defaultAnimation;
if (Platform.OS === 'ios') {
animationConfig = LayoutAnimation.create(
Expand Down

0 comments on commit 5dad02a

Please sign in to comment.