mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-02 14:50:43 +00:00
Implement prop extraction for side and alignmentBaseline. Cleanup extractText, fix linting.
This commit is contained in:
@@ -33,31 +33,31 @@ enum AlignmentBaseline {
|
||||
center("center"),
|
||||
top("top");
|
||||
|
||||
private final String weight;
|
||||
private final String alignment;
|
||||
|
||||
AlignmentBaseline(String weight) {
|
||||
this.weight = weight;
|
||||
AlignmentBaseline(String alignment) {
|
||||
this.alignment = alignment;
|
||||
}
|
||||
|
||||
public static AlignmentBaseline getEnum(String strVal) {
|
||||
if (!weightToEnum.containsKey(strVal)) {
|
||||
if (!alignmentToEnum.containsKey(strVal)) {
|
||||
throw new IllegalArgumentException("Unknown String Value: " + strVal);
|
||||
}
|
||||
return weightToEnum.get(strVal);
|
||||
return alignmentToEnum.get(strVal);
|
||||
}
|
||||
|
||||
private static final Map<String, AlignmentBaseline> weightToEnum;
|
||||
private static final Map<String, AlignmentBaseline> alignmentToEnum;
|
||||
|
||||
static {
|
||||
final Map<String, AlignmentBaseline> tmpMap = new HashMap<>();
|
||||
for (final AlignmentBaseline en : AlignmentBaseline.values()) {
|
||||
tmpMap.put(en.weight, en);
|
||||
tmpMap.put(en.alignment, en);
|
||||
}
|
||||
weightToEnum = ImmutableMap.copyOf(tmpMap);
|
||||
alignmentToEnum = ImmutableMap.copyOf(tmpMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return weight;
|
||||
return alignment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class FontData {
|
||||
private static final String WORD_SPACING = "wordSpacing";
|
||||
private static final String LETTER_SPACING = "letterSpacing";
|
||||
private static final String TEXT_DECORATION = "textDecoration";
|
||||
private static final String ALIGNMENT_BASELINE = "alignment-baseline";
|
||||
private static final String ALIGNMENT_BASELINE = "alignmentBaseline";
|
||||
|
||||
final double fontSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user