question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[w3c] ☂️ Web Styles (Part 1) umbrella issue

See original GitHub issue

Add 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

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.
    • borderEndEndRadius is equivalent to borderBottomEndRadius.
    • borderEndStartRadius is equivalent to borderBottomStartRadius.
    • borderStartEndRadius is equivalent to borderTopEndRadius.
    • borderStartStartRadius is equivalent to borderTopStartRadius.
    • borderBlockColor is equivalent to borderTopColor & borderBottomColor.
    • borderBlockEndColor is equivalent to borderBottomColor.
    • borderBlockStartColor is equivalent to borderTopColor.
    • borderInlineColor is equivalent to borderEndColor & borderStartColor.
    • borderInlineEndColor is equivalent to borderEndColor.
    • borderInlineStartColor is equivalent to borderStartColor.
    • borderBlockStyle is equivalent to borderTopStyle & borderBottomStyle.
    • borderBlockEndStyle is equivalent to borderBottomStyle.
    • borderBlockStartStyle is equivalent to borderTopStyle.
    • borderInlineStyle is equivalent to borderEndStyle & borderStartStyle.
    • borderInlineEndStyle is equivalent to borderEndStyle.
    • borderInlineStartStyle is equivalent to borderStartStyle.
    • borderBlockWidth is equivalent to borderTopWidth & borderBottomWidth.
    • borderBlockEndWidth is equivalent to borderBottomWidth.
    • borderBlockStartWidth is equivalent to borderTopWidth.
    • borderInlineWidth is equivalent to borderEndWidth & borderStartWidth.
    • borderInlineEndWidth is equivalent to borderEndWidth.
    • borderInlineStartWidth is equivalent to borderStartWidth.
    • Map marginInlineStart to marginStart.
    • Map marginInlineEnd to marginEnd.
    • Map marginBlockStart to marginTop.
    • Map marginBlockEnd to marginBottom.
    • Map marginBlock to marginVertical.
    • Map marginInline to marginHorizontal.
    • Map paddingInlineStart to paddingStart.
    • Map paddingInlineEnd to paddingEnd.
    • Map paddingBlockStart to paddingTop.
    • Map paddingBlockEnd to paddingBottom.
    • Map paddingBlock to paddingVertical.
    • Map paddingInline to paddingHorizontal.
    • inset is equivalent to top & bottom & right & left.
    • insetBlock is equivalent to top & bottom.
    • insetBlockEnd is equivalent to bottom.
    • insetBlockStart is equivalent to top.
    • insetInline is equivalent to right & left.
    • insetInlineEnd is equivalent to right or left.
    • insetInlineStart is equivalent to right or left.
  • Add objectFit. Partial equivalent to the resizeMode style and prop of <Image>. https://github.com/facebook/react-native/pull/34576
    • Map objectFit === 'contain' to resizeMode = 'contain'.
    • Map objectFit === 'cover' to resizeMode = 'cover'
    • Map objectFit === 'fill' to resizeMode = 'stretch'
    • Map objectFit === 'scale-down' to resizeMode = 'contain'
  • Add pointerEvents. Equivalent to the pointerEvents prop of <View>. https://github.com/facebook/react-native/pull/34586/
    • Retain the React Native specific box-none and box-only values.
  • Add userSelect. Equivalent to using selectable prop on <Text>. https://github.com/facebook/react-native/pull/34575
  • Add verticalAlign. https://github.com/facebook/react-native/pull/34567
    • Map verticalAlign to textAlignVertical.
    • Map verticalAlign === 'middle' to textAlignVertical = 'center';

Examples:

<View
  style={{
    pointerEvents: 'none'
  }}
>

<Text
  style={{
    userSelect: 'none',
    verticalAlign: 'middle'
  }}
>

<Image
  style={{
    objectFit: 'cover'
  }}
>

New features

<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:open
  • Created a year ago
  • Reactions:70
  • Comments:47 (32 by maintainers)

github_iconTop GitHub Comments

9reactions
meftuncacommented, Aug 15, 2022

please support for ‘transform-origin’ and ‘display:grid’

7reactions
sarulathaduraicommented, Sep 6, 2022

Hi @necolas I will be taking this

 Add native support for single/multiple CSS box shadows.
 Cross-platform shadows to replace Android elevation style, and buggy iOS shadow* styles.```
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found