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

scrollIntoView can fail on android due to View collapsing #259

Closed
slorber opened this issue May 29, 2018 · 5 comments
Closed

scrollIntoView can fail on android due to View collapsing #259

slorber opened this issue May 29, 2018 · 5 comments

Comments

@slorber
Copy link
Collaborator

slorber commented May 29, 2018

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

@slorber
Copy link
Collaborator Author

slorber commented May 29, 2018

Also noticed that on Android, taking measures on mount return bad measures. It looks like adding setTimeout before measure ensures to get better result.

@sebasgarcep
Copy link
Contributor

@slorber For some reason I never saw this issue in my notifications. Did you solve this issue?

@slorber
Copy link
Collaborator Author

slorber commented Dec 10, 2018

@sebasgarcep
Copy link
Contributor

sebasgarcep commented Dec 10, 2018

@slorber Could you send a pull request with this change and some documentation on why it needs to work this way?

@slorber
Copy link
Collaborator Author

slorber commented Dec 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants