Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Keyboard events fired for resizing side-by-side apps #16574

Closed
adierkens opened this issue Oct 27, 2017 · 1 comment
Closed

[Android] Keyboard events fired for resizing side-by-side apps #16574

adierkens opened this issue Oct 27, 2017 · 1 comment
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@adierkens
Copy link
Contributor

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

Environment:

  • OS: macOS Sierra 10.12.6
  • Node: 6.5.0
  • Yarn: 0.22.0
  • npm: 4.1.1
  • Watchman: 4.7.0
  • Xcode: Xcode 9.0 Build version 9A235
  • Android Studio: 2.2 AI-145.3537739

Packages: (wanted => installed)

  • react: 16.0.0-alpha.12 => 16.0.0-alpha.12
  • react-native: ^0.48.4 => 0.48.4

Target Platform: Android (API >= 25)

Steps to Reproduce

  1. Setup a keyboard event listener for keyboardDidShow and keyboardDidHide:
import { Keyboard } from 'react-native';

Keyboard.addListener('keyboardDidShow', () => {
    console.log('keyboardDidShow');
});

Keyboard.addListener('keyboardDidHide', () => {
    console.log('keyboardDidHide');
});
  1. On an Android tablet (API 25+), enter split-screen mode (long press the square in the bottom thing), and drag to resize the react-native view smaller. Everytime the view goes from taller to shorter, both keyboard events fire.

Expected Behavior

  • Since there's no keyboard on the screen, and no input that could potentially trigger one, I wouldn't expect any keyboard events to be published.

Actual Behavior

  • Keyboard events are fired when no keyboard is in sight.

resize_keyboard

Note the console logs for keyboard events in the debugger.

I suspect it's due to ReactRootView checking to see if the screen size shrunk by at least the height of a keyboard (which in this case it did), and it thinks that the viewport change was caused by a keyboard poping up.

ReactRootView.java#checkForKeyboardEvents

Reproducible Demo

https://snack.expo.io/rkKcJ1W0W
-- or --
https://gist.github.com/adierkens/f7ea7c7dbd6b9da18b9fc6f2b2e0a664

Note: split screen mode is only API 25+, since the snack preview only supports 21 and 22, the preview doesn't exhibit the bug behavior.

@stale
Copy link

stale bot commented Dec 26, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 26, 2017
@stale stale bot closed this as completed Jan 2, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

1 participant