From 28b8f036272767343d6c0a75ac926431a43077a0 Mon Sep 17 00:00:00 2001 From: Yamin Yassin Date: Wed, 13 May 2026 19:00:36 +0100 Subject: [PATCH 1/2] Use public unstable_TextAncestorContext API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit React Native 0.81 exposed TextAncestorContext as a public API (facebook/react-native#52368). Switch from the deep import path 'react-native/Libraries/Text/TextAncestor' to the public 'unstable_TextAncestorContext' export. The deep-import target file in React Native exists solely as a backwards-compatibility shim for react-strict-dom — see https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Text/TextAncestor.js which carries a TODO from @huntie to delete it once this cross-repo reference is fixed. Same React Context object, no behavioral change. Test mock updated to match the new import path; old deep-import mock deleted. --- .../src/native/react-native/TextAncestorContext.js | 2 +- .../react-native/Libraries/Text/TextAncestor.js | 10 ---------- .../tests/__mocks__/react-native/index.js | 2 ++ 3 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 packages/react-strict-dom/tests/__mocks__/react-native/Libraries/Text/TextAncestor.js diff --git a/packages/react-strict-dom/src/native/react-native/TextAncestorContext.js b/packages/react-strict-dom/src/native/react-native/TextAncestorContext.js index 0ca869b7..0419e846 100644 --- a/packages/react-strict-dom/src/native/react-native/TextAncestorContext.js +++ b/packages/react-strict-dom/src/native/react-native/TextAncestorContext.js @@ -7,5 +7,5 @@ * @flow strict-local */ -import TextAncestorContext from 'react-native/Libraries/Text/TextAncestor'; +import { unstable_TextAncestorContext as TextAncestorContext } from 'react-native'; export { TextAncestorContext }; diff --git a/packages/react-strict-dom/tests/__mocks__/react-native/Libraries/Text/TextAncestor.js b/packages/react-strict-dom/tests/__mocks__/react-native/Libraries/Text/TextAncestor.js deleted file mode 100644 index ef76dc58..00000000 --- a/packages/react-strict-dom/tests/__mocks__/react-native/Libraries/Text/TextAncestor.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const TextAncestorContext = 'TextAncestorContext'; - -export default TextAncestorContext; diff --git a/packages/react-strict-dom/tests/__mocks__/react-native/index.js b/packages/react-strict-dom/tests/__mocks__/react-native/index.js index 65e14ca4..01aadcd7 100644 --- a/packages/react-strict-dom/tests/__mocks__/react-native/index.js +++ b/packages/react-strict-dom/tests/__mocks__/react-native/index.js @@ -120,6 +120,8 @@ export const View = 'View'; export const experimental_LayoutConformance = 'LayoutConformance'; +export const unstable_TextAncestorContext = 'TextAncestorContext'; + export const useColorScheme = jest.fn().mockReturnValue('light'); export const useWindowDimensions = jest From b7d34ba654a8c471ca4a89ad4e9e5ca53c0f86e0 Mon Sep 17 00:00:00 2001 From: Yamin Yassin Date: Thu, 28 May 2026 09:53:15 +0100 Subject: [PATCH 2/2] Update benchmark react-native mock for unstable_TextAncestorContext --- packages/benchmarks/perf/mocks/TextAncestorContext.js | 10 ---------- packages/benchmarks/perf/mocks/react-native.js | 2 ++ packages/benchmarks/perf/rollup.config.mjs | 7 ------- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 packages/benchmarks/perf/mocks/TextAncestorContext.js diff --git a/packages/benchmarks/perf/mocks/TextAncestorContext.js b/packages/benchmarks/perf/mocks/TextAncestorContext.js deleted file mode 100644 index ef76dc58..00000000 --- a/packages/benchmarks/perf/mocks/TextAncestorContext.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const TextAncestorContext = 'TextAncestorContext'; - -export default TextAncestorContext; diff --git a/packages/benchmarks/perf/mocks/react-native.js b/packages/benchmarks/perf/mocks/react-native.js index da5bd9f1..596969b4 100644 --- a/packages/benchmarks/perf/mocks/react-native.js +++ b/packages/benchmarks/perf/mocks/react-native.js @@ -111,6 +111,8 @@ export const TextInput = 'TextInput'; export const Text = 'Text'; +export const unstable_TextAncestorContext = 'TextAncestorContext'; + export const View = 'View'; export const experimental_LayoutConformance = 'LayoutConformance'; diff --git a/packages/benchmarks/perf/rollup.config.mjs b/packages/benchmarks/perf/rollup.config.mjs index d8b785a4..0b6c82e5 100644 --- a/packages/benchmarks/perf/rollup.config.mjs +++ b/packages/benchmarks/perf/rollup.config.mjs @@ -43,13 +43,6 @@ const config = [ __dirname, './mocks/ViewNativeComponent.js' ) - }, - { - find: 'react-native/Libraries/Text/TextAncestor', - replacement: path.resolve( - __dirname, - './mocks/TextAncestorContext.js' - ) } ] }),