@@ -42,6 +42,11 @@ @interface RCTTextInputComponentView () <
4242
4343static NSSet <NSNumber *> *returnKeyTypesSet;
4444
45+ static BOOL RCTAdjustsFontForContentSizeCategoryFromTextAttributes (const TextAttributes &textAttributes)
46+ {
47+ return textAttributes.allowFontScaling .value_or (true );
48+ }
49+
4550@implementation RCTTextInputComponentView {
4651 TextInputShadowNode::ConcreteState::Shared _state;
4752 UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
@@ -92,6 +97,8 @@ - (instancetype)initWithFrame:(CGRect)frame
9297
9398 _backedTextInputView = defaultProps->multiline ? [RCTUITextView new ] : [RCTUITextField new ];
9499 _backedTextInputView.textInputDelegate = self;
100+ _backedTextInputView.adjustsFontForContentSizeCategory =
101+ RCTAdjustsFontForContentSizeCategoryFromTextAttributes (defaultProps->textAttributes );
95102 _ignoreNextTextInputCall = NO ;
96103 _comingFromJS = NO ;
97104 _didMoveToWindow = NO ;
@@ -145,6 +152,8 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
145152 const auto &newTextInputProps = static_cast <const TextInputProps &>(*_props);
146153 _backedTextInputView.defaultTextAttributes =
147154 RCTNSTextAttributesFromTextAttributes (newTextInputProps.getEffectiveTextAttributes (RCTFontSizeMultiplier ()));
155+ _backedTextInputView.adjustsFontForContentSizeCategory =
156+ RCTAdjustsFontForContentSizeCategoryFromTextAttributes (newTextInputProps.textAttributes );
148157 }
149158}
150159
@@ -298,6 +307,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
298307 defaultAttributes[RCTAttributedStringEventEmitterKey] =
299308 _backedTextInputView.defaultTextAttributes [RCTAttributedStringEventEmitterKey];
300309 _backedTextInputView.defaultTextAttributes = defaultAttributes;
310+ _backedTextInputView.adjustsFontForContentSizeCategory =
311+ RCTAdjustsFontForContentSizeCategoryFromTextAttributes (newTextInputProps.textAttributes );
301312 }
302313
303314 if (newTextInputProps.selectionColor != oldTextInputProps.selectionColor ) {
0 commit comments