-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Can onLayout also provide the page position, like measure does? #10556
Comments
I don't think there's a technical reason for this, it's more that it's bad form to use the absolute page position all the time. It seems like you have a valid workaround so I am going to close this issue. |
So, there's a workaround for this, but it's really awkward -- you need to save a child view as a ref, and then use that ref in a callback in another callback in onLayout. There are legitimate use cases for absolute page positioning, one of which is drag/drop; if you want to know if one component has been dropped onto another when the two don't share a common immediate parent. If there's no technical limitation preventing this from being surfaced as a param to onLayout (or on another event handler) then could we re-open this issue? |
the workaround looks like this, fwiw:
|
I'm also after the On a slightly different but related note, my |
A good reason that Currently, any components that rely on panning behavior are forced to do absolute comparisons, and this issue makes that really hard by forcing people to use a |
I am also in need of these properties. Has anyone gotten anywhere? |
FWIW, I was also hoping |
I'm currently using RN: 0.52.0. Here is my "2¢" on this topic.
This is not the case for me! I have a layout similar to the following:
So, I'm interested in getting the y coordinate of the innermost
If I also call
Notice that
Notice the After this, I do not get any further Now, according to the docs:
This seems to imply that they are the same... and I would rather get the measurements from Also, So, my conclusion is that they are not the same, |
Description
The
onLayout
callback now provides in its layout data the same information as themeasure
(NativeMethodsMixin) callback does, except for the missing absolute page position. Is there a technical reason for this, or can these 2 values also be included in theonLayout
data?I'm now calling
measure
(i.e. triggering the callback) in theonLayout
callback, in order to know whenmeasure(
) can provide (update) information, but this seems to be double work.The text was updated successfully, but these errors were encountered: