[w3c] ☂️ Web Styles (Part 1) umbrella issue
See original GitHub issueAdd support for Web styles to components
This is the umbrella issue for basic React DOM / Web style additions to React Native components, as described in this proposal: “RFC: Reduce fragmentation across platforms”.
Each of the tasks listed below can be tackled with individual PRs that link back to this issue. Not every task has a known solution or implementation yet, so feel free to discuss implementation details in the comments. Each new style property should take priority over any existing equivalents.
Styles
Basic extensions
-
aspectRatio
support for string values, i.e.,'16 / 9'
, to align with CSS. https://github.com/facebook/react-native/pull/34629 -
fontVariant
support for space-separated string values, i.e.,'small-caps common-ligatures'
. https://github.com/facebook/react-native/pull/34641 -
fontWeight
support for number values, i.e.,900
. https://github.com/facebook/react-native/pull/34598 -
transform
support for string values, i.e.,'scaleX(2) translateX(20px)'
. https://github.com/facebook/react-native/pull/34660#pullrequestreview-1104804653
Examples:
<View
style={{
aspectRatio: '16 / 9',
transform: 'scaleX(2) translateX(20px)'
}}
>
<Text
style={{
fontVariant: 'small-caps common-ligatures',
fontWeight: 900
}}
>
Equivalents
-
direction
. - Add CSS Logical Properties.
- https://github.com/facebook/react-native/pull/35342
- https://github.com/facebook/react-native/pull/35572
-
borderEndEndRadius
is equivalent toborderBottomEndRadius
. -
borderEndStartRadius
is equivalent toborderBottomStartRadius
. -
borderStartEndRadius
is equivalent toborderTopEndRadius
. -
borderStartStartRadius
is equivalent toborderTopStartRadius
. -
borderBlockColor
is equivalent toborderTopColor
&borderBottomColor
. -
borderBlockEndColor
is equivalent toborderBottomColor
. -
borderBlockStartColor
is equivalent toborderTopColor
. -
borderInlineColor
is equivalent toborderEndColor
&borderStartColor
. -
borderInlineEndColor
is equivalent toborderEndColor
. -
borderInlineStartColor
is equivalent toborderStartColor
. -
borderBlockStyle
is equivalent toborderTopStyle
&borderBottomStyle
. -
borderBlockEndStyle
is equivalent toborderBottomStyle
. -
borderBlockStartStyle
is equivalent toborderTopStyle
. -
borderInlineStyle
is equivalent toborderEndStyle
&borderStartStyle
. -
borderInlineEndStyle
is equivalent toborderEndStyle
. -
borderInlineStartStyle
is equivalent toborderStartStyle
. -
borderBlockWidth
is equivalent toborderTopWidth
&borderBottomWidth
. -
borderBlockEndWidth
is equivalent toborderBottomWidth
. -
borderBlockStartWidth
is equivalent toborderTopWidth
. -
borderInlineWidth
is equivalent toborderEndWidth
&borderStartWidth
. -
borderInlineEndWidth
is equivalent toborderEndWidth
. -
borderInlineStartWidth
is equivalent toborderStartWidth
.
- Map
marginInlineStart
tomarginStart
. - Map
marginInlineEnd
tomarginEnd
. - Map
marginBlockStart
tomarginTop
. - Map
marginBlockEnd
tomarginBottom
. - Map
marginBlock
tomarginVertical
. - Map
marginInline
tomarginHorizontal
. - Map
paddingInlineStart
topaddingStart
. - Map
paddingInlineEnd
topaddingEnd
. - Map
paddingBlockStart
topaddingTop
. - Map
paddingBlockEnd
topaddingBottom
. - Map
paddingBlock
topaddingVertical
. - Map
paddingInline
topaddingHorizontal
.
-
inset
is equivalent totop
&bottom
&right
&left
. -
insetBlock
is equivalent totop
&bottom
. -
insetBlockEnd
is equivalent tobottom
. -
insetBlockStart
is equivalent totop
. -
insetInline
is equivalent toright
&left
. -
insetInlineEnd
is equivalent toright
orleft
. -
insetInlineStart
is equivalent toright
orleft
.
- Add
objectFit
. Partial equivalent to theresizeMode
style and prop of<Image>
. https://github.com/facebook/react-native/pull/34576- Map
objectFit === 'contain'
toresizeMode = 'contain'
. - Map
objectFit === 'cover'
toresizeMode = 'cover'
- Map
objectFit === 'fill'
toresizeMode = 'stretch'
- Map
objectFit === 'scale-down'
toresizeMode = 'contain'
- Map
- Add
pointerEvents
. Equivalent to thepointerEvents
prop of<View>
. https://github.com/facebook/react-native/pull/34586/- Retain the React Native specific
box-none
andbox-only
values.
- Retain the React Native specific
- Add
userSelect
. Equivalent to usingselectable
prop on<Text>
. https://github.com/facebook/react-native/pull/34575 - Add
verticalAlign
. https://github.com/facebook/react-native/pull/34567- Map
verticalAlign
totextAlignVertical
. - Map
verticalAlign === 'middle'
totextAlignVertical = 'center'
;
- Map
Examples:
<View
style={{
pointerEvents: 'none'
}}
>
<Text
style={{
userSelect: 'none',
verticalAlign: 'middle'
}}
>
<Image
style={{
objectFit: 'cover'
}}
>
New features
- Add expanded support for CSS Colors, e.g.,
hsla()
. Potentially via Colorjs.io. https://github.com/facebook/react-native/pull/34600 - Add
gap
. https://github.com/facebook/yoga/pull/1116 - Add
textShadow
. https://github.com/facebook/react-native/pull/34645- Similar to React Native textShadow props
<View
style={{
boxShadow: '1px 1px 1px 1px #eee',
backgroundColor: 'hsla(50,50,50,0.5)',
backgroundImage: 'url(https://image.png)',
pointerEvents: 'none',
transform: 'scale(0.9)',
width: '5rem'
}}
>
<Text
style={{
textShadow: '1px 1px 1px #eee',
userSelect: 'none',
verticalAlign: 'middle'
}}
>
<Image
style={{
objectFit: 'cover'
}}
>
Issue Analytics
- State:
- Created a year ago
- Reactions:70
- Comments:47 (32 by maintainers)
Top Results From Across the Web
Metro - BLUNT umbrellas
Our small compact umbrella for easy travel. Compact, convenient, and collapsible, the BLUNT Metro is perfect for the urban dweller.
Read more >Basta Sole® Umbrellas & Cabanas - Tropitone Furniture
Patio Umbrellas and Market Umbrellas, from Tropitone, provide focal points of color, shade, romance and sophistication in a variety of spaces.
Read more >Cisco Umbrella | Leader in Cloud Cybersecurity & SASE ...
Cisco Umbrella is cloud-delivered enterprise network security which provides users with a first line of defense against cybersecurity threats.
Read more >Meet the First Man Who Dared to Use an Umbrella - Faena
One day, in the 17th century, Jonas Hanway dared to go out into the streets of ... that is now an essential part...
Read more >Save on wide range of umbrellas & shades collection
Reach new heights in style with our 16 ft patio umbrella or go modest under a 9 ft umbrella. Our 10 ft premium...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
please support for ‘transform-origin’ and ‘display:grid’
Hi @necolas I will be taking this