Skip to content

Delete TextAncestor compatibility shim#56813

Draft
yaminyassin wants to merge 1 commit into
facebook:mainfrom
yaminyassin:chore/delete-text-ancestor-shim
Draft

Delete TextAncestor compatibility shim#56813
yaminyassin wants to merge 1 commit into
facebook:mainfrom
yaminyassin:chore/delete-text-ancestor-shim

Conversation

@yaminyassin
Copy link
Copy Markdown

@yaminyassin yaminyassin commented May 13, 2026

Summary:

Deletes packages/react-native/Libraries/Text/TextAncestor.js, which exists solely as a backwards-compatibility shim for react-strict-dom. The shim's own comment carries a TODO from @huntie to delete it once the cross-repo reference is fixed:

// Compatibility module for ReactStrictDOMTextAncestorContext.native.js.flow (react-strict-dom)
// TODO(huntie): Delete after we've fixed this cross-repo reference

import TextAncestorContext from './TextAncestorContext';

export default TextAncestorContext;

RSD has now switched to the public unstable_TextAncestorContext API in facebook/react-strict-dom#477. Once that PR merges and a new react-strict-dom version is published, this shim is no longer needed.

Verified clean

No internal React Native consumers reference the shim, every internal user imports the canonical TextAncestorContext directly:

  • packages/react-native/index.js:124-125require('./Libraries/Text/TextAncestorContext').default
  • packages/react-native/index.js.flow:132export {default as unstable_TextAncestorContext} from './Libraries/Text/TextAncestorContext'
  • packages/react-native/Libraries/Components/TextInput/TextInput.js:58import TextAncestorContext from '../../Text/TextAncestorContext'
  • packages/react-native/Libraries/Components/View/View.js:13 — same
  • packages/react-native/Libraries/Text/Text.js:24import TextAncestorContext from './TextAncestorContext'
  • packages/react-native/Libraries/Text/Text.d.ts:230export const unstable_TextAncestorContext: React.Context<boolean> (TS public API export, unaffected)

No __snapshots__, BUCK/BUILD files, .flowconfig, or tsconfig.json references the shim path.

Changelog:

[Internal] [Removed] - Delete Libraries/Text/TextAncestor compatibility shim

Test Plan:

Followed the steps in How to Run and Write Tests and How to Contribute Code on macOS with Node v24.11.0 / Yarn 1.22.22.

$ yarn install --ignore-scripts
Done in 112.26s.

$ yarn lint
Done in 27.00s.

$ yarn flow
No errors!
Done in 29.05s.

$ yarn test-typescript
Done in 1.46s.

$ yarn test
Test Suites: 275 passed, 275 total
Tests:       1 skipped, 5635 passed, 5636 total
Snapshots:   1798 passed, 1798 total
Time:        51.557 s

$ yarn build-types --validate
PASS  API snapshot is up to date.
Done in 16.56s.

All five JS-level checks pass. The public TypeScript API surface (ReactNativeApi.d.ts) is unchanged — the shim was a .js-only re-export and never part of the typed public API.

Dependencies / merge order

Marked as draft. Do not merge until react-strict-dom has shipped a release containing facebook/react-strict-dom#477, otherwise published versions of react-strict-dom that still use react-native/Libraries/Text/TextAncestor will fail at runtime when consumers upgrade React Native.

I'll un-draft this PR once the strict-dom side ships.

The shim file `packages/react-native/Libraries/Text/TextAncestor.js`
was kept solely to support react-strict-dom's deep import. The
file's own comment carried a TODO from @huntie to delete it once
the cross-repo reference was fixed.

react-strict-dom has now switched to the public
`unstable_TextAncestorContext` API
(facebook/react-strict-dom#477), exposed in facebook#52368.

No internal React Native consumers reference this shim — both
`packages/react-native/index.js` and `index.js.flow` import
`./Libraries/Text/TextAncestorContext` directly.

## Changelog:

[INTERNAL] - Delete TextAncestor compatibility shim
@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 May 13, 2026
@huntie
Copy link
Copy Markdown
Member

huntie commented May 13, 2026

Let's see if this passes CI once imported 😄

@yaminyassin
Copy link
Copy Markdown
Author

yaminyassin commented May 13, 2026

@huntie finally getting patched 😂

The strict-dom side is in facebook/react-strict-dom#477. It might take a while on their side but i'll let you know when its merged!

These is my first contribution to the project so let me know what i can change/improve 😄

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants