[iOS][Fabric] Changing Dynamic Type while the app is running does not re-lay out text (root not dirtied on a layout-context-only change)
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
Start with RootShadowNode.cpp and inspect RootShadowNode::clone, then follow layoutContext into YogaLayoutableShadowNode::configureYogaTree. The issue identifies the three layout-context inputs that need to trigger layout dirtiness and explains why comparing the full context would be too broad. Reproduce the Dynamic Type change on iOS with the New Architecture, then verify existing layout tests cover the context changes and that text relays out after the change.
索引モデルが issue の本文から書いたものです。
説明
Description
On iOS with the New Architecture, changing the system text size (Dynamic Type) while the app is running has no visible effect on text already on screen. React Native receives the new fontSizeMultiplier, but no layout pass runs, so text keeps its launch-time size until the app is restarted. Text mounted after the change can pick up the new size, which produces mixed layouts.
Steps to reproduce
- Build a Release app with React Native 0.88.1 (New Architecture) and any
<Text>that hasallowFontScalingleft at its default. - Launch it on an iOS simulator or device.
- Without closing the app, change the text size (Settings › Display & Brightness › Text Size, or on a simulator
xcrun simctl ui <udid> content_size accessibility-extra-large). - Return to the app.
Expected: text re-lays out at the new size.
Actual: nothing changes, in either direction. Relaunching renders the new size correctly.
Root cause
-
RCTFabricSurfacehandlesUIContentSizeCategoryDidChangeNotificationby calling_updateLayoutContextwith the newfontSizeMultiplier, which reachesSurfaceHandler::constraintLayout. That commitsRootShadowNode::clone(propsParserContext, layoutConstraints, layoutContext). -
RootShadowNode::cloneonly callsdirtyLayout()when the layout constraints change:if (layoutConstraints != getConcreteProps().layoutConstraints) { newRootShadowNode->dirtyLayout(); } -
For a layout-context-only change, the root stays clean.
RootShadowNode::layoutIfNeededthen returns early (getIsLayoutClean()), solayoutTree→configureYogaTreenever runs. -
That means the existing font-scale handling in
YogaLayoutableShadowNode::configureYogaTreenever gets a chance to run, even thoughenableFontScaleChangesUpdatingLayoutdefaults totrue. That code marks measurable nodes dirty when theirfontSizeMultiplierdiffers from the new one. -
pointScaleFactorandswapLeftAndRightInRTLare consumed byconfigureYogaTreein the same way, so a change to either alone has the same problem.
The same code is on main as of 2026-11-10 (RootShadowNode.cpp last changed in 178c30d7ac). #59285 makes ParagraphShadowNode drop content built for another fontSizeMultiplier, but that only helps once a layout pass actually runs.
Proposed fix
Dirty the root when any layout-context input that configureYogaTree consumes changes:
- if (layoutConstraints != getConcreteProps().layoutConstraints) {
+ const auto& previousContext = getConcreteProps().layoutContext;
+ if (layoutConstraints != getConcreteProps().layoutConstraints ||
+ layoutContext.fontSizeMultiplier != previousContext.fontSizeMultiplier ||
+ layoutContext.pointScaleFactor != previousContext.pointScaleFactor ||
+ layoutContext.swapLeftAndRightInRTL !=
+ previousContext.swapLeftAndRightInRTL) {
newRootShadowNode->dirtyLayout();
}
The full LayoutContext == is deliberately not used: it also compares affectedNodes (a per-pass pointer) and the viewport fields, which would dirty the root on unrelated commits.
I traced this in source and reproduced the symptom in a Release build. I have not run the patched build myself, because our app uses the prebuilt React Native core.
Versions
React Native 0.88.1 (also present on 0.88-stable and main), Expo SDK 58, iOS 26.5 simulator, New Architecture, Hermes.
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.5k
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 188
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react/react-native のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
react/react-native#59945 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
react/react-native#59944 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
react/react-native#59942 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
react/react-native#59939 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
react/react-native#59929 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
react/react-native の issue をすべて見る
似ている issue
-
backlog
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
EchoTools/nevr-runtime#2385 ·
メンテナーはふだん 1 日以内に返信
-
type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
tensorflow/tflite-micro#3995 ·
メンテナーはふだん 1 日以内に返信
-
CPU update 1.31xオープンspeed-report
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
mw00/project-maya#961 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
not for AI lovers
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信