mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Extend Text measurement to support includeFontPadding prop
Summary: This diff exposes the Text.includeFontPadding prop to java, then it uses the prop to calculate the height of Text components correctly. changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric Reviewed By: shergin Differential Revision: D21446737 fbshipit-source-id: efe73fb6b0d402c3275ac8c012fa8fa06b743bdd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4e59508a8e
commit
561a97f699
@@ -46,6 +46,7 @@ public class TextLayoutManager {
|
||||
private static final String INLINE_VIEW_PLACEHOLDER = "0";
|
||||
|
||||
private static final Object sSpannableCacheLock = new Object();
|
||||
private static final boolean DEFAULT_INCLUDE_FONT_PADDING = true;
|
||||
private static LruCache<String, Spannable> sSpannableCache = new LruCache<>(spannableCacheSize);
|
||||
|
||||
public static boolean isRTL(ReadableMap attributedString) {
|
||||
@@ -221,7 +222,10 @@ public class TextLayoutManager {
|
||||
|
||||
int textBreakStrategy =
|
||||
TextAttributeProps.getTextBreakStrategy(paragraphAttributes.getString("textBreakStrategy"));
|
||||
boolean includeFontPadding = true;
|
||||
boolean includeFontPadding =
|
||||
paragraphAttributes.hasKey("includeFontPadding")
|
||||
? paragraphAttributes.getBoolean("includeFontPadding")
|
||||
: DEFAULT_INCLUDE_FONT_PADDING;
|
||||
|
||||
if (preparedSpannableText == null) {
|
||||
throw new IllegalStateException("Spannable element has not been prepared in onBeforeLayout");
|
||||
|
||||
Reference in New Issue
Block a user