Skip to content

Commit afcf734

Browse files
committed
Reorganize and expand on CSS subset
1 parent 6cf50f5 commit afcf734

File tree

1 file changed

+59
-21
lines changed

1 file changed

+59
-21
lines changed

proposals/0000-reduce-fragmentation.md

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -375,26 +375,21 @@ The styling capabilities of React Native should be significantly expanded to cov
375375
* [ ] `StyleSheet.create()` should obfuscate styles to prevent introspection (i.e., revert identify function change). On web, we need to be able to remove the JavaScript style objects from bundles to support build-time optimization like extraction to CSS files.
376376
* [ ] `StyleSheet` should be a function that returns native props, e.g., `const nativeProps = StyleSheet(...styles)`. On web, this is used to pass DOM `className` and `style` props, whereas on native it can be used to pass flattened/transformed styles and any other other native props to native components.
377377

378-
## CSS compatibility
378+
## CSS Compatibility
379+
380+
Existing properties that can be adjusted to align with the CSS spec.
379381

380382
* [x] `aspectRatio`. Support string values, i.e., `'16 / 9'`, to align with CSS.
381-
* [ ] `backgroundImage`. Add support for setting background images via `url()`. Stretch: support CSS gradients.
382-
* [ ] `boxShadow`. Add native support for CSS box shadows to replace buggy, iOS-specific `shadow*` styles.
383383
* [x] `fontVariant` support space-separated string values to align with CSS.
384384
* [x] `fontWeight` support number values to align with React DOM / CSS.
385-
* [ ] `lineClamp` is equivalent to `numberOfLines` prop on `<Text>` components.
386385
* [x] `objectFit` is equivalent to `resizeMode` for `<Image>`.
387386
* [x] `pointerEvents` is equivalent to `pointerEvents` prop.
388387
* [ ] `position`. Support for `fixed` and `sticky` values.
389-
* [ ] `textShadow`. Add native support for CSS text shadows.
390388
* [x] `transform`. Support using string values to set transforms.
391389
* [x] `verticalAlign` is equivalent to `textAlignVertical`.
392-
* [ ] `visibility`. Add support for visually hiding elements.
393390
* [x] `userSelect`. Equivalent to using `selectable` prop on `<Text>`.
394391

395-
## CSS Logical Properties
396-
397-
Support CSS logical property names, i.e., `paddingInlineStart` rather than only non-standard `paddingStart`. Support subtree-level logical properties, where setting the `dir` prop to `ltr` or `rtl` alters the way logical properties are resolved. Currently, React Native only supports global writing direction configuration for Android.
392+
Existing logical properties that can be adjusted to adopt the CSS standard names. In addition, React Native will need to add native support for subtree-level writing direction controls. Setting the `dir` prop (or `direction` style) to `ltr` or `rtl` on an element should alter the way logical properties are resolved in the subtree.
398393

399394
* [ ] `direction` is equivalent to `writingDirection`.
400395
* [ ] `borderEndEndRadius` is equivalent to `borderBottomEndRadius`.
@@ -439,24 +434,18 @@ Support CSS logical property names, i.e., `paddingInlineStart` rather than only
439434
* [ ] `insetInlineEnd` is equivalent to `right` or `left`.
440435
* [ ] `insetInlineStart` is equivalent to `right` or `left`.
441436

442-
## CSS Lengths
443-
444-
Support major units where supported by CSS.
445-
446-
* [ ] `em` units.
447-
* [ ] `rem` units.
448-
* [ ] `px` units.
449-
* [ ] `v*` units.
450-
* [ ] `%` units.
451-
452437
## CSS Animations
453438

454-
Support declarative keyframes and animations that can be optimized on the native side and avoid the need for `Animated`. See [animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation)).
439+
Support declarative keyframes and animations that can be optimized on the native side and avoid the need for `Animated`. Consider dispatching the corresponding W3C animation events too. See [animation](https://developer.mozilla.org/en-US/docs/Web/CSS/animation)).
455440

456441
## CSS Colors
457442

458443
Support CSS 4 Colors using [Colorjs.io](https://colorjs.io/).
459444

445+
## CSS Container Queries
446+
447+
Prepare for [CSS Container Queries](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries).
448+
460449
## CSS Custom Properties
461450

462451
Support CSS custom property syntax `--variable-name`. This could be shimmed in user-space on top of the existing `StyleSheet` API, with a React Context used to provide variables and values to a subtree.
@@ -465,13 +454,62 @@ Support CSS custom property syntax `--variable-name`. This could be shimmed in u
465454

466455
Support declarative filters as used by the CSS [filter](https://developer.mozilla.org/en-US/docs/Web/CSS/filter) style.
467456

457+
## CSS Functions
458+
459+
* [ ] `calc()`(https://developer.mozilla.org/en-US/docs/Web/CSS/calc)
460+
* [ ] `clamp()`(https://developer.mozilla.org/en-US/docs/Web/CSS/clamp)
461+
* [ ] `max()`(https://developer.mozilla.org/en-US/docs/Web/CSS/max)
462+
* [ ] `min()`(https://developer.mozilla.org/en-US/docs/Web/CSS/min)
463+
* [ ] `minmax()`(https://developer.mozilla.org/en-US/docs/Web/CSS/minmax)
464+
* [ ] `url()`(https://developer.mozilla.org/en-US/docs/Web/CSS/url)
465+
* [ ] `var()`(https://developer.mozilla.org/en-US/docs/Web/CSS/var)
466+
467+
## CSS Lengths
468+
469+
Support major units where supported by CSS.
470+
471+
* [ ] `em` units.
472+
* [ ] `rem` units.
473+
* [ ] `px` units.
474+
* [ ] `v*` units.
475+
* [ ] `%` units.
476+
468477
## CSS Media Queries
469478

470479
Support CSS Media Queries. Although Media Queries are not a preferred long-term solution, [Container Queries](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries) are not yet widely supported by browsers. This could be shimmed in user-space on top of the existing `StyleSheet` API.
471480

481+
## CSS Properties and Values
482+
483+
Miscellaneous CSS properties and values that should be supported on native.
484+
485+
* [ ] `backgroundImage`. Add support for setting background images via `url()`. Stretch: support CSS gradients.
486+
* [ ] `boxSizing`.
487+
* [ ] `boxShadow`. Add native support for CSS box shadows to replace buggy, iOS-specific `shadow*` styles.
488+
* [ ] `caretColor`.
489+
* [ ] `clipPath`.
490+
* [ ] `display` values of `block`, `inline`, `inline-block`, `inline-flex`.
491+
* [ ] `float`.
492+
* [ ] [`justifySelf`](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self). Sets the way a box is justified inside its alignment container along the appropriate axis.
493+
* [ ] (`lineClamp` is equivalent to `numberOfLines` prop on `<Text>` components).
494+
* [ ] [`objectPosition`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position).
495+
* [ ] `overflowBlock`.
496+
* [ ] `overflowInline`.
497+
* [ ] `overflowX`.
498+
* [ ] `overflowY`.
499+
* [ ] [`placeContent`](https://developer.mozilla.org/en-US/docs/Web/CSS/place-content). Shorthand for setting `alignContent` and `justifyContent`. Value is an enum of `baseline`, `first baseline`, `last baseline`, `center`, `end`, `flex-start`, `flex-end`, `left`, `right`, `safe`, `space-around`, `space-between`, `space-evenly`, `start`, `stretch`, `unsafe`. Note that `space-evenly` should also be supported for `alignContent` and `justifyContent`.
500+
* [ ] [`placeItems`](https://developer.mozilla.org/en-US/docs/Web/CSS/place-items). Shorthand for setting `alignItems` and `justifyItems`. Value is an enum of `auto`, `baseline`, `first baseline`, `last baseline`, `center`, `end`, `flex-start`, `flex-end`, `left`, `right`, `start`, `stretch`.
501+
* [ ] [`placeSelf`](https://developer.mozilla.org/en-US/docs/Web/CSS/place-self). Shorthand for setting `alignSelf` and `justifySelf`. Value is an enum of `auto`, `baseline`, `first baseline`, `last baseline`, `center`, `end`, `flex-start`, `flex-end`, `left`, `normal`, `right`, `start`, `stretch`.
502+
* [ ] [`rotate`](https://developer.mozilla.org/en-US/docs/Web/CSS/rotate).
503+
* [ ] [`scale`](https://developer.mozilla.org/en-US/docs/Web/CSS/scale).
504+
* [ ] `textShadow`. Add native support for CSS text shadows.
505+
* [ ] [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action).
506+
* [ ] [`translate`](https://developer.mozilla.org/en-US/docs/Web/CSS/translate).
507+
* [ ] `visibility`. Add support for visually hiding elements.
508+
* [ ] [`whiteSpace`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space).
509+
472510
## CSS Transitions
473511

474-
Support declarative transitions that can be optimized on the native side and avoid the need for `Animated`. Support `transitionProperty`, `transitionDuration`, `transitionTimingFunction`, and `transitionDelay` styles (see [transition](https://developer.mozilla.org/en-US/docs/Web/CSS/transition)).
512+
Support declarative transitions that can be optimized on the native side and avoid the need for `Animated`. Support `transitionProperty`, `transitionDuration`, `transitionTimingFunction`, and `transitionDelay` styles (see [transition](https://developer.mozilla.org/en-US/docs/Web/CSS/transition)). Consider dispatching the corresponding W3C transition events too.
475513

476514
-----
477515

0 commit comments

Comments
 (0)