Repository navigation
[w3c] ☂️ Web Styles (Part 1) umbrella issue #34425
Description
Activity
- addedHelp Wanted
Issues ideal for external contributors.Issues ideal for external contributors.Platform: AllAn issue that impacts all the platformsAn issue that impacts all the platformson Aug 15, 2022 See companion issue related to props #34424
Would flex
gapapply here, or does that fall out of scope since it's still missing in Yoga?From experience, the lack of gap support is one of the worst parts of styling on native vs. web. Shadows are up there too, but I use them less often.
It would be great to add
objectPositionfor images too.Would flex
gapapply here, or does that fall out of scope since it's still missing in Yoga?Yes, that needs to be added to Yoga which is a whole other project.
It would be great to add
objectPositionfor images too.Done.
Reacted by Fernando Rojo, Moritz Mahringer and Emmanuel Chucks 🇬🇭please support for 'transform-origin' and 'display:grid'
Reacted by Richard Simpson, javascripter, Hampus Sjöberg, Nathan, Piotr Łukomiak, Kolia Nalbandian, Fernando Rojo, vince, Arvin A, Emmanuel Chucks 🇬🇭 and 2 morePercentage values for
translatewould be good. We already have this on web.
Not sure if it's related to yoga, like flexgap.translateX(50%),translateY(100%)Reacted by Valerii Smirnov, Jaehyeon Park/박재현, Emmanuel Chucks 🇬🇭 and Seyed Mohammad AsadiYes, that needs to be added to Yoga which is a whole other project.
already done, waiting for merge for 6 months
Reacted by Lorenzo Sciandra, Nicola Corti, Mohamed Ahmed Elhalwagui, Anthony Agostino, Jelte Homminga, Moritz Mahringer, Jude Tejada and Emmanuel Chucks 🇬🇭- changed the title
[-][w3c] Web Styles umbrella issue[/-][+][w3c] ☂️ Web Styles umbrella issue[/+]on Aug 16, 2022 - pinned this issue
on Aug 17, 2022 - Add expanded support for CSS Colors, e.g.,
hsla(). Potentially via Colorjs.io.
Hi @necolas, which CSS Color Module Level do we wanna meet? React native already supports
rgb(),rgba(),#rgb,#rrggbb,#rgba,#rrggbbaa,hsl(),hsla(), colors as int values (in RGB mode) and named colors, what else do we want to support?hwb()?lab()?- Add expanded support for CSS Colors, e.g.,
Level 4, as Colorjs.io does. Functions should also support space-separated values, not just comma separated.
Reacted by Gabriel Donadel Dall'Agnol, Lucas Gomes and Emmanuel Chucks 🇬🇭I added a new section for improving cross-platform compatibility of
Animated.It should be relatively easy to make Animated a separate package that works on web for React Native for Web. This would allow developers to have the same version of Animated running and avoid me needing to update Animated at arbitrary points in time, which is also tedious and error prone, as I have to check for new sources of crashes and copy-paste-edit dozens of files that use different module syntaxes and internal import paths to RN public APIs, like
StyleSheet.already react/yoga#1116, waiting for merge for 6 months
The RN team had planned to move to a new layout engine, but probably not anymore. So since there is an existing PR and it has a chance of being merged soon, I'll add
gaptoo.Reacted by Fernando Rojo, Moritz Mahringer and Emmanuel Chucks 🇬🇭82 remaining items
- added a commit that references this issue
on Jun 19, 2023 There's a bug inAnimatedwhen using the string syntax for transforms. The string syntax needs to be converted back to an array of objects forAnimatedTransformto work properly.Edit: nvm, someone was stringifying an animated object instead of updating their string interpolation code
There's a bug in
Animatedwhen using the string syntax for transforms. The string syntax needs to be converted back to an array of objects forAnimatedTransformto work properly.@necolas
Should a similar approach as in necolas/react-native-web@ed83baa fix this issue in react-native?Also, haven't looked at it though seems like the new
AnimatedObject#36935 also doesn't take care of this.- added a commit that references this issue
on Jul 6, 2023 - pinned this issue
on Jul 10, 2023 - added a commit that references this issue
on Aug 23, 2023 - unpinned this issue
on Oct 12, 2023 Could we add
position: stickyhere as well?Reacted by Alex Hernandez and sph/nx- added a commit that references this issue
on Nov 5, 2024 Closing as completed
Reacted by Lorenzo Sciandra and Finn Pauls
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 (All available in React Native 0.71)
aspectRatiosupport for string values, i.e.,'16 / 9', to align with CSS. feat: Add string support for aspectRatio #34629fontVariantsupport for space-separated string values, i.e.,'small-caps common-ligatures'.fontWeightsupport for number values, i.e.,900. Feat/fontweight number value #34598transformsupport for string values, i.e.,'scaleX(2) translateX(20px)'. feat: Add string support to the transform property #34660 (review)Examples:
Equivalents
Available in React Native 0.71
direction.objectFit. Partial equivalent to theresizeModestyle and prop of<Image>. feat: Adding support for objectFit a partial equivalent to the resizeMode style and prop of <Image>. #34576objectFit === 'contain'toresizeMode = 'contain'.objectFit === 'cover'toresizeMode = 'cover'objectFit === 'fill'toresizeMode = 'stretch'objectFit === 'scale-down'toresizeMode = 'contain'objectFitvalue of'none'.pointerEvents. Equivalent to thepointerEventsprop of<View>. feat: Added pointerEvents style equivalent to pointerEvents prop #34586box-noneandbox-onlyvalues.userSelect. Equivalent to usingselectableprop on<Text>. feat: add userSelect style equivalent to selectable #34575verticalAlign. feat: Add support for verticalAlign style #34567verticalAligntotextAlignVertical.verticalAlign === 'middle'totextAlignVertical = 'center';Available in React Native 0.72
borderEndEndRadiusis equivalent toborderBottomEndRadius.borderEndStartRadiusis equivalent toborderBottomStartRadius.borderStartEndRadiusis equivalent toborderTopEndRadius.borderStartStartRadiusis equivalent toborderTopStartRadius.marginInlineStarttomarginStart.marginInlineEndtomarginEnd.marginBlockStarttomarginTop.marginBlockEndtomarginBottom.marginBlocktomarginVertical.marginInlinetomarginHorizontal.paddingInlineStarttopaddingStart.paddingInlineEndtopaddingEnd.paddingBlockStarttopaddingTop.paddingBlockEndtopaddingBottom.paddingBlocktopaddingVertical.paddingInlinetopaddingHorizontal.insetis equivalent totop&bottom&right&left.insetBlockis equivalent totop&bottom.insetBlockEndis equivalent tobottom.insetBlockStartis equivalent totop.insetInlineis equivalent toright&left.insetInlineEndis equivalent torightorleft.insetInlineStartis equivalent torightorleft.borderBlockColoris equivalent toborderTopColor&borderBottomColor.borderBlockEndColoris equivalent toborderBottomColor.borderBlockStartColoris equivalent toborderTopColor.Outstanding (version to be determined)
borderStylevalue of'none'.transformOriginfeat: transform-origin #37606borderInlineColoris equivalent toborderEndColor&borderStartColor.borderInlineEndColoris equivalent toborderEndColor.borderInlineStartColoris equivalent toborderStartColor.borderBlockStyleis equivalent toborderTopStyle&borderBottomStyle.borderBlockEndStyleis equivalent toborderBottomStyle.borderBlockStartStyleis equivalent toborderTopStyle.borderInlineStyleis equivalent toborderEndStyle&borderStartStyle.borderInlineEndStyleis equivalent toborderEndStyle.borderInlineStartStyleis equivalent toborderStartStyle.borderBlockWidthis equivalent toborderTopWidth&borderBottomWidth.borderBlockEndWidthis equivalent toborderBottomWidth.borderBlockStartWidthis equivalent toborderTopWidth.borderInlineWidthis equivalent toborderEndWidth&borderStartWidth.borderInlineEndWidthis equivalent toborderEndWidth.borderInlineStartWidthis equivalent toborderStartWidth.Examples:
New features
Available in React Native 0.71
hsla(). Potentially via Colorjs.io. feat: Add expanded support for CSS Colors #34600gap. Add support for gap, column-gap, and row-gap yoga#1116