-
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
[Android] NativeMethodsMixin.measure.call returning undefined values for a component #19103
Comments
Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out? If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions. |
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run Thank you for your contributions. |
same issue. componentDidMount() {
setTimeout(() => {
this.body.measure((x, y, width, height, pageX, pageY) => {
console.log(pageY)
})
})
} x, y, width, height, pageX, pageY, all are undefined in android, but ok in iOS |
I get the same problem - reproducible Snack Within my project, if I set Either way these are not the correct values. As mentioned, works perfectly on iOS. |
@hannigand On my case, no solution like setting |
@jgfidelis I'm not still able to get anything over than 0 values. I added the following props on all onLayout={this.getMeasurements}
renderToHardwareTextureAndroid
collapsable={false} Edit: Instead of measuring, I decided to capture values through the onLayout callback. |
This issue was marked as lacking information required by the issue template. There has been no activity on this issue for a while, so I will go ahead and close it. If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here. If you are the author of this issue and you believe this issue was closed in error (i.e. you have edited your issue to ensure it meets the template requirements), please let us know. |
Please reopen this as other people have expressed the problem as well. I think it follows the templates too. |
wrapping the component in a |
I had the same issue with a view outside of the viewport. Adding It was hard to find this solution. I suggest we can add this to the documentation of the measure method. A small notice on Android optimizing views and returning |
I could reproduce this issue. |
I also have this problem in rn 0.59.5 in Android |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes.
Environment
OS: macOS High Sierra 10.13.4
Node: 9.4.0
Yarn: 1.5.1
npm: 3.10.10
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.0 => 0.53.0
Test device: Android simulator: Pixel running Android 5.1
Steps to Reproduce
This is an Android only issue, on iOS it is fine.
This code:
(x, y, width, height, pageX, pageY)
all are undefined. This happens only on one of our components, calledIcon
, like in the example above.If I do:
The
NativeMethodsMixin.measure.call
works just fine, so the problem is with ourIcon
component.Our Icon component is:
And
InlineIcon
is:Expected Behavior
Measure method return correct values.
Actual Behavior
Measure method returns undefined values on my
Icon
component.Can anyone give an insight about this? I am just curious... I tried to omit some code, but if you need more information, let me know.
Thanks
PS: already tried all solutions specified here: #3282
The text was updated successfully, but these errors were encountered: