Allow outline* styles on stable React Native#493
Open
MoOx wants to merge 1 commit into
Open
Conversation
Closes react#467 ## Root cause The `outlineColor`/`outlineOffset`/`outlineStyle`/`outlineWidth` keys were gated behind `version.experimental` in `isAllowedStyleKey.js` (and `outlineOffset`/`outlineWidth` in `isLengthStyleKey.js`). Any style key not in the allow-list is silently dropped, so these props never reached React Native on a published release. `version.experimental` is **not** a user-facing flag. It is derived from the RN version at runtime https://github.com/facebook/react-strict-dom/blob/c4e69e0fa486ba8df835a2e3f396206070c17153/packages/react-strict-dom/src/native/modules/version.js#L13-L20 It is `true` **only** on HEAD/nightly builds and `false` on every published RN release (e.g. 0.84.0). So the documented `outline*` support was unreachable for normal apps, with no way to opt in. ## Why it was a stale gate The `outline*` keys were originally added alongside `boxShadow`, `filter`, and `mixBlendMode` in the same experimental block. Those three were later graduated into the always-allowed set; the four `outline*` keys were left behind by oversight. RN has supported `outline*` since 0.77, and RSD's minimum is `react-native >=0.82.0`, so the props are safe to allow unconditionally for every supported version. ## Why tests didn't catch it The test suite mocks the RN version as `major: 1000` (`tests/__mocks__/react-native/index.js`), which forces `experimental === true`. The existing `outline*` test therefore passed in CI while the same code dropped the props for users on stable RN. ## The fix Graduated the keys out of the experimental gate (same treatment already given to `boxShadow`/`filter`/`mixBlendMode`): - `isAllowedStyleKey.js` — moved `outlineColor`, `outlineOffset`, `outlineStyle`, `outlineWidth` into the main allow-list; removed the now-empty `if (version.experimental)` block and its unused `version` import. - `isLengthStyleKey.js` — moved `outlineOffset`, `outlineWidth` into the main length-key set; removed the experimental block and unused import. ## Result `outline*` now resolves on all supported RN versions, the documentation becomes accurate with no changes, the existing test now exercises the real (non-experimental) path, Flow passes, and the full CSS suite (141 tests) is green.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR makes outline* CSS properties unconditionally allowed/handled in the native CSS style-key sets by removing the previous version.experimental gating.
Changes:
- Removed
versionimport and the associatedversion.experimentalconditional blocks in style-key set definitions. - Added
outlineOffset/outlineWidthto the length style key set unconditionally. - Added
outlineColor/outlineOffset/outlineStyle/outlineWidthto the allowed style key set unconditionally.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react-strict-dom/src/native/css/isLengthStyleKey.js | Makes outlineOffset/outlineWidth always treated as length-valued style keys by moving them into the static set. |
| packages/react-strict-dom/src/native/css/isAllowedStyleKey.js | Makes outline* properties always considered allowed style keys by moving them into the static set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+123
to
+126
| 'outlineColor', | ||
| 'outlineOffset', | ||
| 'outlineStyle', | ||
| 'outlineWidth', |
Comment on lines
+66
to
+67
| 'outlineOffset', | ||
| 'outlineWidth', |
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
workflow: benchmarks/perf (native)Comparison of performance test results, measured in operations per second. Larger is better.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #467
Root cause
The
outlineColor/outlineOffset/outlineStyle/outlineWidthkeys were gated behindversion.experimentalinisAllowedStyleKey.js(andoutlineOffset/outlineWidthinisLengthStyleKey.js). Any style key not in the allow-list is silently dropped, so these props never reached React Native on a published release.version.experimentalis not a user-facing flag. It is derived from the RN version at runtimehttps://github.com/facebook/react-strict-dom/blob/c4e69e0fa486ba8df835a2e3f396206070c17153/packages/react-strict-dom/src/native/modules/version.js#L13-L20
It is
trueonly on HEAD/nightly builds andfalseon every published RN release (e.g. 0.84.0). So the documentedoutline*support was unreachable for normal apps, with no way to opt in.Why it was a stale gate
The
outline*keys were originally added alongsideboxShadow,filter, andmixBlendModein the same experimental block. Those three were later graduated into the always-allowed set; the fouroutline*keys were left behind by oversight. RN has supportedoutline*since 0.77, and RSD's minimum isreact-native >=0.82.0, so the props are safe to allow unconditionally for every supported version.Why tests didn't catch it
The test suite mocks the RN version as
major: 1000(tests/__mocks__/react-native/index.js), which forcesexperimental === true. The existingoutline*test therefore passed in CI while the same code dropped the props for users on stable RN.The fix
Graduated the keys out of the experimental gate (same treatment already given to
boxShadow/filter/mixBlendMode):isAllowedStyleKey.js— movedoutlineColor,outlineOffset,outlineStyle,outlineWidthinto the main allow-list; removed the now-emptyif (version.experimental)block and its unusedversionimport.isLengthStyleKey.js— movedoutlineOffset,outlineWidthinto the main length-key set; removed the experimental block and unused import.Result
outline*now resolves on all supported RN versions, the documentation becomes accurate with no changes, the existing test now exercises the real (non-experimental) path, Flow passes, and the full CSS suite (141 tests) is green.