Skip to content

Commit

Permalink
Set default keyboard state (#6101)
Browse files Browse the repository at this point in the history
## Summary

This PR addresses a requested issue that randomly occurs on some Android
devices:
```
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.swmansion.reanimated.keyboard.KeyboardState.asInt()' on a null object reference
        at com.swmansion.reanimated.keyboard.KeyboardAnimationManager.notifyAboutKeyboardChange(KeyboardAnimationManager.java:45)
```
This NullPointerException was likely caused by the lack of a default
value for the `mState` field.
  • Loading branch information
piaskowyk committed Jun 11, 2024
1 parent fe0b50e commit 9d6b45f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.facebook.react.uimanager.PixelUtil;

public class Keyboard {
private KeyboardState mState;
private KeyboardState mState = KeyboardState.UNKNOWN;
private int mHeight = 0;
private int mActiveTransitionCounter = 0;
private static final int CONTENT_TYPE_MASK = WindowInsetsCompat.Type.ime();
Expand Down

0 comments on commit 9d6b45f

Please sign in to comment.