mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Serialize and de-serialize text attachments for Android
Summary: This diff implements serialization and deserialization of text attachments as part of the calculation of layout of text components changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D20087251 fbshipit-source-id: dbcbd22f856aadace14343205548154ea80c8464
This commit is contained in:
committed by
Facebook Github Bot
parent
58d683a688
commit
17a62b72b7
@@ -62,6 +62,8 @@ public class ViewProps {
|
||||
public static final String START = "start";
|
||||
public static final String END = "end";
|
||||
|
||||
public static final String IS_ATTACHMENT = "isAttachment";
|
||||
|
||||
public static final String AUTO = "auto";
|
||||
public static final String NONE = "none";
|
||||
public static final String BOX_NONE = "box-none";
|
||||
|
||||
@@ -35,6 +35,9 @@ public class TextAttributeProps {
|
||||
|
||||
private static final int DEFAULT_TEXT_SHADOW_COLOR = 0x55000000;
|
||||
|
||||
protected boolean mIsAttachment = false;
|
||||
protected float mAttachmentWidth;
|
||||
protected float mAttachmentHeight;
|
||||
protected float mLineHeight = Float.NaN;
|
||||
protected boolean mIsColorSet = false;
|
||||
protected boolean mAllowFontScaling = true;
|
||||
@@ -126,6 +129,21 @@ public class TextAttributeProps {
|
||||
setTextShadowRadius(getIntProp(PROP_SHADOW_RADIUS, 1));
|
||||
setTextShadowColor(getIntProp(PROP_SHADOW_COLOR, DEFAULT_TEXT_SHADOW_COLOR));
|
||||
setTextTransform(getStringProp(PROP_TEXT_TRANSFORM));
|
||||
setAttachmentHeight(getFloatProp(ViewProps.HEIGHT, UNSET));
|
||||
setAttachmentWidth(getFloatProp(ViewProps.WIDTH, UNSET));
|
||||
setIsAttachment(getBooleanProp(ViewProps.IS_ATTACHMENT, false));
|
||||
}
|
||||
|
||||
private void setIsAttachment(boolean isAttachment) {
|
||||
mIsAttachment = isAttachment;
|
||||
}
|
||||
|
||||
private void setAttachmentWidth(float attachmentWidth) {
|
||||
mAttachmentWidth = attachmentWidth;
|
||||
}
|
||||
|
||||
private void setAttachmentHeight(float attachmentHeight) {
|
||||
mAttachmentHeight = attachmentHeight;
|
||||
}
|
||||
|
||||
private boolean getBooleanProp(String name, boolean defaultValue) {
|
||||
|
||||
Reference in New Issue
Block a user