Skip to content

Commit 443c3c1

Browse files
committed
fix paragraph styling within text input
1 parent 06751aa commit 443c3c1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

+7
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
268268
defaultAttributes[RCTAttributedStringEventEmitterKey] =
269269
_backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey];
270270
#endif
271+
272+
NSMutableParagraphStyle *paragraphStyle = defaultAttributes[NSParagraphStyleAttributeName];
273+
274+
if (!newTextInputProps.multiline) {
275+
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
276+
defaultAttributes[NSParagraphStyleAttributeName] = paragraphStyle;
277+
}
271278
_backedTextInputView.defaultTextAttributes = defaultAttributes;
272279
}
273280

0 commit comments

Comments
 (0)