react-native icon indicating copy to clipboard operation
react-native copied to clipboard

keyboardWillShow not triggered in Android

Open ortutay opened this issue 11 years ago • 45 comments

I am registering for keyboardWillShow like this:

this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillShow', this.updateKeyboardSpace);

This works fine in iOS, but in Android it does not trigger the event as expected. keyboardDidShow does work in Android.

ortutay avatar Oct 16 '15 21:10 ortutay

I can confirm this.

satya164 avatar Oct 17 '15 17:10 satya164

Yes, we have the same problem.

hufeng avatar Oct 19 '15 15:10 hufeng

so it is not supported in Android?

yychun1217 avatar Nov 04 '15 15:11 yychun1217

Keyboard events are unimplemented on Android.

ide avatar Nov 04 '15 20:11 ide

@yychun1217 KeyboardDidShow and KeyboardDidHide works on Android, so I guess whatever you wanted to do with will show events, you could do on did show instead.

satya164 avatar Nov 04 '15 21:11 satya164

@satya164 Both KeyboardDidShow and keyboardWillShow events will not been triggered on Android, as I've set android:windowSoftInputMode to adjustResize.

componentDidMount() {
  DeviceEventEmitter.addListener('KeyboardDidShow', e => {
    // Nope
  });

  DeviceEventEmitter.addListener('keyboardWillShow', e => {
    // Nope
  });
}

matth3wga0 avatar Nov 19 '15 14:11 matth3wga0

@matth3wga0 I'm using adjustResize and KeyboardDidShow and KeyboardDidHide work just fine. - https://github.com/scrollback/io.scrollback.neighborhoods/blob/master/app/views/keyboard-spacer.js

satya164 avatar Nov 19 '15 14:11 satya164

@satya164 I'm using v0.14.2 and running on Android 5.1, what's yours?

matth3wga0 avatar Nov 19 '15 14:11 matth3wga0

@matth3wga0 Was using 0.12 previously, now using 0.15-rc, on Android 5.1.

satya164 avatar Nov 19 '15 14:11 satya164

@satya164 Thanks, I'll have a try with 0.15-rc.

matth3wga0 avatar Nov 19 '15 14:11 matth3wga0

Im using RN 0.18-rc with a Moto X 5.1, keyboardDidHide and keyboardDidShow are both triggered on the showing of the keyboard (Actually, keyboardDidHide is triggered before DidShow!). screen shot 2016-01-12 at 11 06 15 pm

Nothing is triggered on the hiding of the keyboard.

Sh3rawi avatar Jan 12 '16 21:01 Sh3rawi

keyboardWillShow and keyboardDidHide are not in RN 0.18-rc

kristjanmik avatar Jan 14 '16 16:01 kristjanmik

+1 for interest

jblack10101 avatar Jan 20 '16 04:01 jblack10101

+1 Iv'e been trying any way I could find, it looks like any method of knowing when the keyboard is up and it's height does not work anymore :(

Does anyone have a workaround for this?

motiazu avatar Feb 15 '16 15:02 motiazu

+1 RN: 18.1, Android: 5.0.2, Device: LG G2

Iliyass avatar Feb 17 '16 00:02 Iliyass

I use keyboardDidHide and keyboardDidHide here is source code https://github.com/facebook/react-native/blob/228a1fe7d48d57a0fbb2d852135ef94247198aaa/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java#L424

skv-headless avatar Feb 19 '16 09:02 skv-headless

+1 this still doesn't work in android

zoharlevin avatar Feb 23 '16 08:02 zoharlevin

ok, i somehow missed this, so... for anybody who was confused (like me :)) i can confirm that keyboardWillShow + keyboardWillHide don't work on android but keyboardDidShow and keyboardDidHide do work on android.

thanks @skv-headless

zoharlevin avatar Feb 24 '16 08:02 zoharlevin

@zoharlevin Holy crap it works! Thanks!

motiazu avatar Feb 24 '16 09:02 motiazu

it works, thanks man

On Wed, Feb 24, 2016 at 9:03 AM, motiazu [email protected] wrote:

@zoharlevin https://github.com/zoharlevin Holy crap it works! Thanks!

— Reply to this email directly or view it on GitHub https://github.com/facebook/react-native/issues/3468#issuecomment-188147867 .

Iliyass avatar Feb 24 '16 17:02 Iliyass