React-native-keyboard-aware-scroll-view: error on rotation when keyboard open

Created on 6 Jul 2018  路  11Comments  路  Source: APSL/react-native-keyboard-aware-scroll-view

This component causes the following error when the screen is rotated while the keyboard is visible:

view

A normal ScrollView doesn't cause this error, so I'm fairly certain it's an issue with this component.

Has anyone else run into this? This component has solved all of my keyboard avoiding behaviors very well, but unfortunately I can't use it if it's going to blow up when the user rotates their phone.

Upstream issue

Most helpful comment

@shigggster, that looks promising! I won't be able to check it for a couple weeks but I'll let you know when I do if it solves the issue I was having.

All 11 comments

Hi @ktownsend-cbre!

Thanks for the report. This seems definitely a issue with react-native-keyboard-aware-scroll-view, but it is an upstream issue with the shadow view tree in the React Native repo.

However, I was responsible of that change into the RN repo, so I'll dig into this next monday and try to come up with a fix for RN.

additional clue from the red error screen that didn't make it to my debug console:

RCTMeasureLayout
RCTUIManager.m:1288

Looking forward to hearing what you find out. I'm good with doing a local patch to RN or to this component if you find a way to fix but it will take a while to release.

@alvaromb, any chance this has been figured out?

It just occurred to me that this issue might be related to calling ref.update() on componentDidUpdate(), which I'm doing to ensure a multi-line text performs the scroll updates as each line is entered. I temporarily disabled that behavior and the error did not occur. That leads me to believe the issue is related to the update function if a screen rotation is in progress when it's called.

Update 7/24: disabling my call to .update() doesn't seem to avoid the error today, but my post after this one does appear to be accurate nonetheless.

In case it's helpful for further troubleshooting...
I had a little time today to dig into this on my own. From what I can tell, the error is occurring when KeyboardAwareHOC.update() is called during phone rotation animations. I was able to narrow it down to when responder.scrollResponderScrollNativeHandleToKeyboard() is called on line 242 of KeyboardAwareHOC.js, which is in an anonymous function for setTimeout(). The variable responder is a ScrollView in my case. I haven't gone any deeper than that yet, but the fact it's happening in a ScrollView method supports the upstream issue as indicated by @alvaromb.

I got the same problem as you @ktownsend-cbre, did you find a way to figure it out ?
@alvaromb Have you take a look ?
Thanks!

@magrinj, I haven't found any workaround yet other than disabling rotation when I'm using the keyboard aware scroll view.

Hi @ktownsend-cbre and @magrinj! I came across a _similar_ issue just the other day. Was wondering if this solution might be tangentially related? #322

We were using KeyboardAwareHOC.update() solve our multi-line scroll issue initially, and kept getting the same error @ktownsend-cbre referenced above. By adding a descendant check (added by @alvaromb, thanks!), we were able to avoid the crash. Hope this helps!

@shigggster, that looks promising! I won't be able to check it for a couple weeks but I'll let you know when I do if it solves the issue I was having.

Didn't have time yet to dive into this issue. Please @ktownsend-cbre notify us in this thread if you manage to solve your issue with the update method.

Was this page helpful?
0 / 5 - 0 ratings