Skip to content

Make renderer View conversions CSS-free (#58786) - #58786

Closed
coado wants to merge 2 commits into
react:mainfrom
coado:export-D119507215
Closed

coado wants to merge 2 commits into
react:mainfrom
coado:export-D119507215

Conversation

@coado

@coado coado commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Move CSS-dependent View conversion implementations for Yoga lengths, value units, transforms, transform origins, and aspect ratios from the exported conversions.h header into conversions.cpp. Keep the supported conversion declarations public and preserve existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to for frameworks eventually.

Update existing conversion tests to exercise the same paths through supported public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507215

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 1, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Oct 1, 2026
@meta-codesync

meta-codesync Bot commented Oct 1, 2026

Copy link
Copy Markdown

@coado has exported this pull request. If you are a Meta employee, you can view the originating Diff in D119507215.

@meta-codesync meta-codesync Bot changed the title Make renderer View conversions CSS-free Make renderer View conversions CSS-free (#58786) Oct 2, 2026
coado added a commit to coado/react-native that referenced this pull request Oct 2, 2026
Summary:

Move CSS-dependent View conversion implementations for Yoga lengths, value units, transforms, transform origins, and aspect ratios from the exported `conversions.h` header into `conversions.cpp`. Keep the supported conversion declarations public and preserve existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to `for frameworks` eventually.

Update existing conversion tests to exercise the same paths through supported public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507215
@coado
coado force-pushed the export-D119507215 branch from d63f245 to 381e632 Compare October 2, 2026 11:01
coado added a commit to coado/react-native that referenced this pull request Oct 2, 2026
Summary:
Pull Request resolved: react#58786

Move CSS-dependent View conversion implementations for Yoga lengths, value units, transforms, transform origins, and aspect ratios from the exported `conversions.h` header into `conversions.cpp`. Keep the supported conversion declarations public and preserve existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to `for frameworks` eventually.

Update existing conversion tests to exercise the same paths through supported public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507215
@coado
coado force-pushed the export-D119507215 branch from 381e632 to 5b7b020 Compare October 2, 2026 11:04
Summary:
Pull Request resolved: react#58785

Move View CSS parsing implementation details for color and length coercion, box shadows, and filters from exported headers into compiled source files. Keep only the supported `coerceColor`, `coerceLength`, and `fromRawValue` declarations in public headers while preserving existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to `for frameworks` eventually.

Update existing conversion tests to exercise the same paths through the public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507169
coado added a commit to coado/react-native that referenced this pull request Oct 2, 2026
Summary:

Move CSS-dependent View conversion implementations for Yoga lengths, value units, transforms, transform origins, and aspect ratios from the exported `conversions.h` header into `conversions.cpp`. Keep the supported conversion declarations public and preserve existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to `for frameworks` eventually.

Update existing conversion tests to exercise the same paths through supported public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507215
@coado
coado force-pushed the export-D119507215 branch from 5b7b020 to 3fa5a89 Compare October 2, 2026 14:53
Summary:
Pull Request resolved: react#58786

Move CSS-dependent View conversion implementations for Yoga lengths, value units, transforms, transform origins, and aspect ratios from the exported `conversions.h` header into `conversions.cpp`. Keep the supported conversion declarations public and preserve existing parsing behavior. This change is necessary to remove CSS headers leaks as visibility of CSS module will be changed to `for frameworks` eventually.

Update existing conversion tests to exercise the same paths through supported public entry points, and regenerate the C++ API snapshots to remove private helper declarations.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D119507215
@coado
coado force-pushed the export-D119507215 branch from 3fa5a89 to 2629f4a Compare October 2, 2026 14:56
@meta-codesync meta-codesync Bot closed this in 791835e Oct 2, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 2, 2026
@meta-codesync

meta-codesync Bot commented Oct 2, 2026

Copy link
Copy Markdown

This pull request has been merged in 791835e.

cipolleschi added a commit that referenced this pull request Oct 7, 2026
#58786 moved parseUnprocessedTransformOriginString from an inline function in
conversions.h into an anonymous namespace in conversions.cpp. Third-party libraries
call it (react-native-unistyles uses it on React Native >= 0.85), so they no longer
compile on Android.

Declare it again in conversions.h and keep the implementation in conversions.cpp, so
no CSS headers leak back into the public header.
meta-codesync Bot pushed a commit that referenced this pull request Oct 7, 2026
Summary:
The Android `react-native-unistyles` job in the [nightly tests](https://github.com/react-native-community/nightly-tests/actions/runs/37455000546) has failed since the `20261003` nightly:

```
TransformOriginConverter.cpp:124:20: error: no member named
'parseUnprocessedTransformOriginString' in namespace 'facebook::react'
```

#58786 moved the transform-origin helpers from `react/renderer/components/view/conversions.h` into `conversions.cpp`. One of them, `parseUnprocessedTransformOriginString`, was an inline function in the public header, and it ended up in an anonymous namespace in the `.cpp`. Libraries can't call it anymore. Unistyles calls it on React Native 0.85 and newer (only when `RN_SERIALIZABLE_STATE` is defined, so in practice only on Android).

This change declares `parseUnprocessedTransformOriginString(const std::string&, TransformOrigin&)` in `conversions.h` again and moves its definition out of the anonymous namespace. The implementation stays in `conversions.cpp`, and the signature uses only `std::string` and `TransformOrigin`, so no CSS headers leak back into the public header. The other helpers #58786 made private stay private.

## Changelog:

[GENERAL] [FIXED] - Restore public `parseUnprocessedTransformOriginString` in `react/renderer/components/view/conversions.h`

Pull Request resolved: #58893

Test Plan:
- Regenerated the C++ API snapshots with Doxygen 1.16.1, the version CI uses: `python -m scripts.cxx-api.parser`. For the Common and Apple views, the only diff this change causes is one restored line: `void facebook::react::parseUnprocessedTransformOriginString(const std::string& value, facebook::react::TransformOrigin& result);`. That is the same line #58786 removed. My local Apple output also had extra codegen entries for the sample TurboModule, so I left those out of the commit.
- In my environment the Android views fail to generate even on clean `main` (`Identifier basic_appender already exists in scope v12`). I added the same line by hand to the three Android snapshots, at the position #58786 removed it from. The `validate-cxx-api-snapshots` job will confirm them.
- `yarn format-check-cpp`: no violations in repository files.
- I couldn't build the C++ locally, so I'm relying on CI for compilation. The change only moves an existing function definition out of an anonymous namespace and adds its declaration.
- After this lands, the Android unistyles job in the nightly tests should compile `TransformOriginConverter.cpp` again.

Reviewed By: christophpurrer

Differential Revision: D123667938

Pulled By: cipolleschi

fbshipit-source-id: 65460434bcf100b35149d077da18c42897e46bea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant