mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix Fabric reusing nodes with a stale font scale (#57246)
Summary: Fixes https://github.com/react/react-native/issues/52895 The original solution to this issue approached this by comparing the font scale used to lay out respective root nodes and re-cloning measurable nodes in the entire tree when it was different. This didn't work when a node within the tree was cloned from a node with an obsolete font scale stored (with root having the correct one). The new node would use the obsolete value in that pass. This PR changes this approach - instead of comparing font scale in `SurfaceHandler::constraintLayout` (only when it changes), it moves the comparison to happen as part of `configureYogaTree`, similarly to `pointScaleFactor`. This way, nodes with an obsolete value stored get re-cloned using the correct one on each commit instead of only on the first one. ## Changelog: [GENERAL][FIXED] - Fixed Fabric reusing nodes with a stale font scale Pull Request resolved: https://github.com/react/react-native/pull/57246 Test Plan: Issue reproducer ||Before|After| |-|-|-| |Android|<video src="https://github.com/user-attachments/assets/0b30ca95-76e9-4ce9-8d8f-418f9d827bea" />|<video src="https://github.com/user-attachments/assets/009be13c-c3b5-4af0-8be1-b44c94ac0496" />| |iOS|<video src="https://github.com/user-attachments/assets/b861b622-a2ea-4cc4-a8db-0e3ad4cae5e7" />|<video src="https://github.com/user-attachments/assets/ec4d6f6e-7558-4430-813b-61a6e911c3b0" />| Reviewed By: javache Differential Revision: D108877387 Pulled By: j-piasecki fbshipit-source-id: f4c5335dc691d30a50db7e6f66744fa9c7295fb2
This commit is contained in:
1 parent
faf0951b4e
commit
45904c8668
14 files changed
+38
-94
No files matched your search
@@ -7415,6 +7415,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -7198,6 +7198,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -7406,6 +7406,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -9496,6 +9496,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -9331,6 +9331,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -9487,6 +9487,7 @@ struct facebook::react::LayoutMetrics {
|
||||
public facebook::react::EdgeInsets borderWidth;
|
||||
public facebook::react::EdgeInsets contentInsets;
|
||||
public facebook::react::EdgeInsets overflowInset;
|
||||
public facebook::react::Float fontSizeMultiplier;
|
||||
public facebook::react::Float pointScaleFactor;
|
||||
public facebook::react::LayoutDirection layoutDirection;
|
||||
public facebook::react::PositionType positionType;
|
||||
|
||||
@@ -5603,6 +5603,7 @@ struct facebook::react::LayoutContext {
|
||||
}
|
||||
|
||||
struct facebook::react::LayoutMetrics {
|
||||
public Float fontSizeMultiplier;
|
||||
public Float pointScaleFactor;
|
||||
public bool operator==(const facebook::react::LayoutMetrics& rhs) const = default;
|
||||
public bool wasLeftAndRightSwapped;
|
||||
|
||||
@@ -5450,6 +5450,7 @@ struct facebook::react::LayoutContext {
|
||||
}
|
||||
|
||||
struct facebook::react::LayoutMetrics {
|
||||
public Float fontSizeMultiplier;
|
||||
public Float pointScaleFactor;
|
||||
public bool operator==(const facebook::react::LayoutMetrics& rhs) const = default;
|
||||
public bool wasLeftAndRightSwapped;
|
||||
|
||||
@@ -5594,6 +5594,7 @@ struct facebook::react::LayoutContext {
|
||||
}
|
||||
|
||||
struct facebook::react::LayoutMetrics {
|
||||
public Float fontSizeMultiplier;
|
||||
public Float pointScaleFactor;
|
||||
public bool operator==(const facebook::react::LayoutMetrics& rhs) const = default;
|
||||
public bool wasLeftAndRightSwapped;
|
||||
|
||||
Reference in new issue
Block a user