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

[ScrollResponder] keyboard lifecycle events not firing

Open vishnevskiy opened this issue 11 years ago • 10 comments

I am using a ScrollView and trying to invoke scrollResponderScrollNativeHandleToKeyboard but it seems that keyboardWillOpenTo is never set and the keyboard lifecycle events are never invoked. Does something else needs to be done to activate them or is this broken?

vishnevskiy avatar Mar 27 '15 18:03 vishnevskiy

@vishnevskiy - did you manage to figure this out or is it still an issue?

brentvatne avatar May 31 '15 17:05 brentvatne

I am facing similar problems. 'keyboardWillOpenTo' remains null throughtout the lifetime, preventing the Scroll Responder from calculating the y offset to scroll to. Any updates on how to go about this?

urvashi01 avatar Jun 06 '15 09:06 urvashi01

Have you tried using https://github.com/johanneslumpe/react-native-keyboardevents ? This seems to offer the functionality that you require albeit down a different path.

MossP avatar Jul 20 '15 19:07 MossP

It looks like keyboardWillShow and other events are not firing at all, you could hook into react-native-keyboardevents as @MossP suggests and fire those events on the DeviceEventEmitter to get that to happen. @sahrens was it intentional to not have these fire automatically?

As an aside: this part of React Native -- scrolling to inputs on focus -- definitely needs some work - I've been digging into it recently and hope to have a good general solution for it soon. This is what I put together on a couple of train rides so far: https://gist.github.com/brentvatne/db1cf9fa16f7fbc514cb

brentvatne avatar Jul 20 '15 19:07 brentvatne

@brentvatne still an issue?, lots of events are now in core.

browniefed avatar Sep 13 '15 20:09 browniefed

@browniefed - this issue seems related to the ScrollView specific events, I'm not sure if those work or really have ever worked in OSS :O

brentvatne avatar Sep 13 '15 23:09 brentvatne

It looks like RCTDeviceEventEmitter emits different object structures throughout the lifetime of the keyboard opening, but ScrollResponder is ultimately only interested in storing one kind, which holds information like keyboardWillOpenTo.

I made some small changes to ScrollResponder event handlers to filter the events, and now things seem to be working ok. I'll do some more testing and update.

/cc @browniefed @brentvatne @urvashi01

Sherlock92 avatar Sep 15 '15 18:09 Sherlock92

@vishnevskiy @Sherlock92 any updates on this? Are you still seeing issues?

jsierles avatar Dec 17 '15 17:12 jsierles

@jsierles actually I can say I'm no longer seeing an issue :)

Sherlock92 avatar Dec 17 '15 17:12 Sherlock92

@Sherlock92 Great - closing this out!

jsierles avatar Dec 17 '15 17:12 jsierles