-
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
Fix 1-pixel height horizontal line disappear #30481
base: main
Are you sure you want to change the base?
Conversation
Without FabricUIManager, On Android devices with a non integer DPI (for example, 2.75), View layoutX/Y may be decimal (for example, 3.25). Using integer type in recursive calculation may cause 1 pixel margin or 1 pixel overlap between adjacent views. The horizontal dividing line of 1 pixel (height: StyleSheet.hairlineWidth) may disappear.
Hi @laotian! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
// We use screenX/screenY (which round to integer pixels) at each node in the hierarchy to | ||
// emulate what the layout would look like if it were actually built with native views which | ||
// have to have integral top/left/bottom/right values | ||
int x = node.getScreenX(); | ||
int y = node.getScreenY(); | ||
float x = node.getLayoutX(); | ||
float y = node.getLayoutY(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should update the comment as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have update the comment, thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ecreeth I have update the comment and I submitted in the original branch. Do I need to launch a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ecreeth Can you review my commit again?
cc @safaiyeh |
@safaiyeh Can you review my PR? |
Based on file history, looks like @mdvacca is the most relevant FB dev to check/review this PR out. cc @dulmandakh |
Thanks for working on this @laotian, I'm importing to review internally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdvacca has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
any update on this pull request? |
|
Summary
On Android devices with a non integer DPI (for example, 2.75), View layoutX/Y may be decimal (for example, 3.25). Using integer type in recursive calculation may cause 1 pixel margin or 1 pixel overlap between adjacent views. The dividing line of 1 pixel (StyleSheet.hairlineWidth) may disappear.
Fixes #22927
Changelog
[Android] [Fixed] - Fix 1-pixel height horizontal line disappear.
Test Plan
manual test
first repeats the problem according to the demo code, and verifies after repair
reproduce steps
demo code
Screenshot
Before Fix
device : Android MI8SE (dpi 2.75)
Fixed