File tree Expand file tree Collapse file tree 6 files changed +19
-8
lines changed
React/Fabric/Mounting/ComponentViews/TextInput
ReactAndroid/src/main/java/com/facebook/react
ReactCommon/react/renderer Expand file tree Collapse file tree 6 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 7
7
8
8
#import " RCTTextInputComponentView.h"
9
9
10
+ #import < react/featureflags/ReactNativeFeatureFlags.h>
10
11
#import < react/renderer/components/iostextinput/TextInputComponentDescriptor.h>
11
12
#import < react/renderer/textlayoutmanager/RCTAttributedTextUtils.h>
12
13
#import < react/renderer/textlayoutmanager/TextLayoutManager.h>
@@ -128,7 +129,7 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
128
129
{
129
130
[super traitCollectionDidChange: previousTraitCollection];
130
131
131
- if (UITraitCollection.currentTraitCollection .preferredContentSizeCategory !=
132
+ if (facebook::react::ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout () && UITraitCollection.currentTraitCollection .preferredContentSizeCategory !=
132
133
previousTraitCollection.preferredContentSizeCategory ) {
133
134
const auto &newTextInputProps = static_cast <const TextInputProps &>(*_props);
134
135
_backedTextInputView.defaultTextAttributes =
Original file line number Diff line number Diff line change 26
26
import com .facebook .react .interfaces .TaskInterface ;
27
27
import com .facebook .react .interfaces .fabric .ReactSurface ;
28
28
import com .facebook .react .interfaces .fabric .SurfaceHandler ;
29
+ import com .facebook .react .internal .featureflags .ReactNativeFeatureFlags ;
29
30
import com .facebook .react .modules .i18nmanager .I18nUtil ;
30
31
import com .facebook .react .runtime .internal .bolts .Task ;
31
32
import com .facebook .react .uimanager .events .EventDispatcher ;
@@ -248,7 +249,11 @@ private static float getPixelDensity(Context context) {
248
249
}
249
250
250
251
private static float getFontScale (Context context ) {
251
- return context .getResources ().getConfiguration ().fontScale ;
252
+ if (ReactNativeFeatureFlags .enableFontScaleChangesUpdatingLayout ()) {
253
+ return context .getResources ().getConfiguration ().fontScale ;
254
+ }
255
+
256
+ return 1f ;
252
257
}
253
258
254
259
private static boolean isRTL (Context context ) {
Original file line number Diff line number Diff line change @@ -1084,7 +1084,10 @@ public void onStartTemporaryDetach() {
1084
1084
@ Override
1085
1085
public void onConfigurationChanged (Configuration newConfig ) {
1086
1086
super .onConfigurationChanged (newConfig );
1087
- applyTextAttributes ();
1087
+
1088
+ if (ReactNativeFeatureFlags .enableBridgelessArchitecture () && ReactNativeFeatureFlags .enableFontScaleChangesUpdatingLayout ()) {
1089
+ applyTextAttributes ();
1090
+ }
1088
1091
}
1089
1092
1090
1093
@ Override
Original file line number Diff line number Diff line change 10
10
#include < cmath>
11
11
12
12
#include < react/debug/react_native_assert.h>
13
+ #include < react/featureflags/ReactNativeFeatureFlags.h>
13
14
#include < react/renderer/attributedstring/AttributedStringBox.h>
14
15
#include < react/renderer/components/view/ViewShadowNode.h>
15
16
#include < react/renderer/components/view/conversions.h>
@@ -36,8 +37,8 @@ ParagraphShadowNode::ParagraphShadowNode(
36
37
37
38
if (!fragment.children && !fragment.props &&
38
39
sourceParagraphShadowNode.getIsLayoutClean () &&
39
- fontSizeMultiplier_ ==
40
- state.attributedString .getBaseTextAttributes ().fontSizeMultiplier ) {
40
+ (! ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout () || fontSizeMultiplier_ ==
41
+ state.attributedString .getBaseTextAttributes ().fontSizeMultiplier )) {
41
42
// This ParagraphShadowNode was cloned but did not change
42
43
// in a way that affects its layout. Let's mark it clean
43
44
// to stop Yoga from traversing it.
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ class BaseTextInputShadowNode : public ConcreteViewShadowNode<
193
193
const LayoutContext& layoutContext) const {
194
194
bool meaningfulState = BaseShadowNode::getState () &&
195
195
BaseShadowNode::getState ()->getRevision () !=
196
- State::initialRevisionValue;
196
+ State::initialRevisionValue && BaseShadowNode::getStateData (). reactTreeAttributedString . getBaseTextAttributes (). fontSizeMultiplier == layoutContext. fontSizeMultiplier ;
197
197
if (meaningfulState) {
198
198
const auto & stateData = BaseShadowNode::getStateData ();
199
199
auto attributedStringBox = stateData.attributedStringBox ;
Original file line number Diff line number Diff line change 9
9
10
10
#include < cxxreact/TraceSection.h>
11
11
#include < react/debug/react_native_assert.h>
12
+ #include < react/featureflags/ReactNativeFeatureFlags.h>
12
13
#include < react/renderer/uimanager/UIManager.h>
13
14
14
15
namespace facebook ::react {
@@ -319,8 +320,8 @@ void SurfaceHandler::constraintLayout(
319
320
propsParserContext, layoutConstraints, layoutContext);
320
321
321
322
// Dirty all measurable nodes when the fontSizeMultiplier changes to
322
- // trigger remeasurement .
323
- if (layoutContext.fontSizeMultiplier !=
323
+ // trigger re-measurement .
324
+ if (ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout () && layoutContext.fontSizeMultiplier !=
324
325
oldRootShadowNode.getConcreteProps ()
325
326
.layoutContext .fontSizeMultiplier ) {
326
327
dirtyMeasurableNodes (*newRoot);
You can’t perform that action at this time.
0 commit comments