-
Notifications
You must be signed in to change notification settings - Fork 649
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
scrollIntoView can fail on android due to View collapsing #259
Comments
Also noticed that on Android, taking measures on mount return bad measures. It looks like adding setTimeout before measure ensures to get better result. |
@slorber For some reason I never saw this issue in my notifications. Did you solve this issue? |
Hi, I actually use https://github.com/slorber/react-native-scroll-into-view and the api design prevent this issue: https://github.com/slorber/react-native-scroll-into-view/blob/master/scrollIntoView.js#L409 |
@slorber Could you send a pull request with this change and some documentation on why it needs to work this way? |
hi @sebasgarcep I don't remember exactly what the problem was, but I think if we try to measure an empty view that collapse, it returns nothing. This is probably an edge case, not worth to be highlighted in main readme, but the user can find this info on this issue const [parentLayout, childLayout] = await Promise.all([
this._measureElement(this._rnkasv_keyboardView),
this._measureElement(element)
]) One idea would be to throw if childLayout is null/undefined here, with a link to this issue |
See facebook/react-native#3282 (comment)
the newly added _measureElement method can actually return nothing if view collapse on Android.
In such case I think we should warn the user and recommend him to use
collapsed={false}
to ensure measures can be taken.cc @sebasgarcep
The text was updated successfully, but these errors were encountered: