-
Notifications
You must be signed in to change notification settings - Fork 4.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
Clarify documentation about when onLayout is called #2056
Comments
👋 Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions. |
@Stale Issue does not fixed |
@Stale Issue does not fixed! |
The answer to the following would also be great to document: are But the answer is quite important and would be great to have documented. |
+1 |
Has anyone found a solution or a work around to get onlayout to fire when size is changed with animation? |
I am trying to find a solution too. Hopefully, that can help https://reactnative.dev/docs/direct-manipulation |
Don't quote me, but what I'm understanding is that |
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions. |
Issues don't become invalid just because nobody has bothered to look at them. |
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions. |
Still needs attention |
Hello, @evelant, did you solve the problem? In my case onLayout gets fired on mount only. Not on translation, rotation, etc. |
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions. |
No, the documentation is still unclear |
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Description
https://reactnative.dev/docs/view#onlayout
Trying to animate elements in my app to the screen locations of other elements. I get the position of those elements in their onLayout callbacks and cache the results. In some (unknown, undocumented) situations onLayout is not called when an element changes position.
The current documentation states
This does not specify that in some situations the layout information will be incorrect or transitional. It also does not specify in which situations
onLayout
will not be called. In my case it appears thatonLayout
is only called on mount but not when a parent changing size causes an element to change x/y position but remain the same size.It would be helpful if the documentation for onLayout were expanded to detail exactly in which situations onLayout will be called and in which situations the position/size information may be inaccurate. What exactly constitutes
layout changes
to fire the event?edit: here are some related issues detailing the undocumented quirks/bugs with onLayout.
facebook/react-native#28775 (animations of transforms don't trigger onLayout)
facebook/react-native#3282 (measure returns undefined on android unless onLayout or collapsable are specified)
facebook/react-native#24219 (reanimated, standard with expo, changes onLayout behavior)
facebook/react-native#23443 (device rotation doesn't trigger onLayout in some situations)
facebook/react-native#19872 (onLayout removed elevation on Android)
Documentation version
v0.63
The text was updated successfully, but these errors were encountered: