-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
onLayout is not getting triggered when view is transforming using Animated.View #28775
Comments
|
|
It's because layout process not involved in transformations at all. Actually |
Have the same problem bro? Did you fix it? |
@vovkasm In that case do you happen to know a method to deal with getting the size and position of elements with a transform or a parent that has a transform? Does that also mean that if you use a transform on a parent element the .measure and If this is the case -- that all children of transformed elements have incorrect onLayout and .measure results -- then it certainly needs to be put in the documentation! |
So here's all of the undocumented or buggy behavior I've encountered with onLayout and .measure so far:
These add up to big frustrations. I don't know how many hours I've lost at this point writing stuff that should work per the docs only to eventually figure out the above list and work around it. These things should at least be documented so others don't have to go through the same thing. I've worked around it mostly by writing a "measurement service" singleton that's injected via context and gets refs to all the stuff I want to measure. I then call a function on the measurement service context to Here's an issue on the documentation repo collecting some of these things: facebook/react-native-website#2056 |
hello @AndrewMorsillo thanks for sharing this. I was wondering if it could be posible to share this singleton you created? Thanks in advance |
hi @AndrewMorsillo, that was really helpful, thank you a lot! I am facing the same issues. I'd be interested too in the singleton and also what edge cases you could not solve with it (and how did you solve these?). Based on you said "I've worked around it mostly"... |
I experience the same issue with
|
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days. |
This issue was closed because the author hasn't provided the requested feedback after 7 days. |
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
I am trying to get the current View y position when my view is translating, but the onLayut is not getting triggered when the transform value change.
React Native version:
System:
OS: macOS 10.15.4
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 47.71 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.6.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: 17.2.4988734
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.4 => 0.61.4
Expected Results
Expect to get current Y value from onLayout function when it is translating.
The text was updated successfully, but these errors were encountered: