Skip to content

Commit 4763cc7

Browse files
MoOxnecolas
authored andcommitted
Document reasoning behind hairlineWidth value
Close #1488
1 parent aa8593b commit 4763cc7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/docs/src/apis/StyleSheet/StyleSheet.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ const styles = StyleSheet.create({
7979

8080
### hairlineWidth
8181

82-
Enables borders of just one physical pixel on retina screens, otherwise it is
83-
equal to a CSS value of 1px.
82+
Equal to 1px. This is not implemented using screen density as browsers may
83+
round sub-pixel values down to `0`, causing the line not to be rendered.

packages/react-native-web/src/exports/StyleSheet/StyleSheet.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const StyleSheet = {
5757
return result;
5858
},
5959
flatten: flattenStyle,
60+
61+
// `hairlineWidth` is not implemented using screen density as browsers may
62+
// round sub-pixel values down to `0`, causing the line not to be rendered.
6063
hairlineWidth: 1
6164
};
6265

0 commit comments

Comments
 (0)