Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ public PreparedLayout prepareLayout(
getYogaSize(minWidth, maxWidth),
getYogaMeasureMode(minWidth, maxWidth),
getYogaSize(minHeight, maxHeight),
getYogaMeasureMode(minHeight, maxHeight),
null /* T219881133: Migrate away from ReactTextViewManagerCallback */);

int maximumNumberOfLines =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ public static Layout createLayout(
float width,
YogaMeasureMode widthYogaMeasureMode,
float height,
YogaMeasureMode heightYogaMeasureMode,
@Nullable ReactTextViewManagerCallback reactTextViewManagerCallback) {
Spannable text =
getOrCreateSpannableForText(context, attributedString, reactTextViewManagerCallback);
Expand Down Expand Up @@ -668,7 +669,7 @@ public static Layout createLayout(
width,
YogaMeasureMode.EXACTLY,
height,
YogaMeasureMode.UNDEFINED,
heightYogaMeasureMode,
minimumFontSize,
maximumNumberOfLines,
includeFontPadding,
Expand Down Expand Up @@ -799,6 +800,7 @@ public static long measureText(
width,
widthYogaMeasureMode,
height,
heightYogaMeasureMode,
reactTextViewManagerCallback);

int maximumNumberOfLines =
Expand Down Expand Up @@ -1080,6 +1082,7 @@ public static WritableArray measureLines(
width,
YogaMeasureMode.EXACTLY,
height,
YogaMeasureMode.EXACTLY,
null);
return FontMetricsUtil.getFontMetrics(
layout.getText(), layout, Preconditions.checkNotNull(sTextPaintInstance.get()), context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function TextAdjustsDynamicLayoutExample(props: {}): React.Node {
<View>
<View style={[styles.subjectContainer, {height}]}>
<Text
testID="adjusting-text"
adjustsFontSizeToFit={true}
numberOfLines={1}
style={styles.subjectText}>
Expand All @@ -28,13 +29,25 @@ export default function TextAdjustsDynamicLayoutExample(props: {}): React.Node {
</View>
</View>
<View style={styles.row}>
<Button onPress={() => setHeight(20)} title="Set Height to 20" />
<Button
testID="set-height-20"
onPress={() => setHeight(20)}
title="Set Height to 20"
/>
</View>
<View style={styles.row}>
<Button onPress={() => setHeight(40)} title="Set Height to 40" />
<Button
testID="set-height-40"
onPress={() => setHeight(40)}
title="Set Height to 40"
/>
</View>
<View style={styles.row}>
<Button onPress={() => setHeight(60)} title="Set Height to 60" />
<Button
testID="set-height-60"
onPress={() => setHeight(60)}
title="Set Height to 60"
/>
</View>
</>
);
Expand Down
Loading