-
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
StyleSheet.hairlineWidth not visible on devices with decimal PixelRatio #22927
Comments
Same problem here on LG Nexus 5X. Some lines with the border width set to |
Same problem here on Samsung S8+ when power saving mode is active (screen resolution: HD+/FHD+ only) When the resolution is WQHD+, all lines seem to be shown. |
I can confirm this on the Nexus 5 (pixel ratio of 2.625) and in my simulator of a Pixel 2 (pixel ratio 2.625). |
Sometimes this happens on iOS, already spotted this problem on an iPhone 7 Plus, but I couldn't find the pattern |
Well, I've noticed that on iPhone Plus devices there will be a downsampling, so the actual pixel ratio would be 2.608. |
On iOS devices, since we know the exact native scale factor and UIKit scale factor, my workaround would be to upsample manually if needed:
|
Is there similar solution for Android devices as mentioned for iPhone 7 plus above? |
@vorasudh The idea is to calculate But sorry I am not familiar with Android, so I am not sure about how to get the |
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. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
@davidleee , Thank you for the suggestion. It works great for iOS. I found a workaround for Android in the meantime. It seems many Android phone companies set their own default fonts that seems to be causing the problem. If you set 'Roboto' as default font of your app the issue on Android seems to go away. |
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. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. 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. |
Environment
Run
react-native info
in your terminal and paste its contents here.Description
StyleSheet.hairlineWidth
works good for most of the devices. If device has pixel ratio that is not intiger it is not visible in some cases. For example, using in list it does render every second separator. And in some cases you can see background through list items, indicating that size of list item is calculated improperly.I am facing this issue on Samsung S9+. Result of
PixelRatio.get()
is2.625
The text was updated successfully, but these errors were encountered: