react-native-persona 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/ios/PersonaInquiry.swift +10 -6
- package/package.json +1 -1
- package/persona-tools/Theme.js +4 -0
- package/persona-tools/Theme.ts +4 -0
- package/persona-tools/lib/AndroidResourcePrinter.js +7 -4
- package/persona-tools/lib/AndroidResourcePrinter.spec.js +2 -0
- package/persona-tools/lib/AndroidResourcePrinter.spec.ts +6 -2
- package/persona-tools/lib/AndroidResourcePrinter.ts +6 -6
package/CHANGELOG.md
CHANGED
package/ios/PersonaInquiry.swift
CHANGED
|
@@ -162,9 +162,11 @@ extension PersonaInquiry {
|
|
|
162
162
|
theme.titleTextColor = color
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
if let fontName = dictionary["titleTextFont"]
|
|
166
|
-
let
|
|
167
|
-
|
|
165
|
+
if let fontName = dictionary["titleTextFont"] {
|
|
166
|
+
let fontSize = int(from: dictionary["titleTextSize"]) ?? 28
|
|
167
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
168
|
+
theme.titleTextFont = font
|
|
169
|
+
}
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
if let alignment = alignment(from: dictionary["titleTextAlignment"]) {
|
|
@@ -180,9 +182,11 @@ extension PersonaInquiry {
|
|
|
180
182
|
theme.bodyTextColor = color
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
if let fontName = dictionary["bodyTextFont"]
|
|
184
|
-
let
|
|
185
|
-
|
|
185
|
+
if let fontName = dictionary["bodyTextFont"] {
|
|
186
|
+
let fontSize = int(from: dictionary["bodyTextSize"]) ?? 17
|
|
187
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
188
|
+
theme.bodyTextFont = font
|
|
189
|
+
}
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
if let alignment = alignment(from: dictionary["bodyTextAlignment"]) {
|
package/package.json
CHANGED
package/persona-tools/Theme.js
CHANGED
|
@@ -16,8 +16,10 @@ var ANDROID_THEME_CONFIG_KEY;
|
|
|
16
16
|
ANDROID_THEME_CONFIG_KEY["accentColor"] = "accentColor";
|
|
17
17
|
ANDROID_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
|
|
18
18
|
ANDROID_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
|
|
19
|
+
ANDROID_THEME_CONFIG_KEY["titleTextSize"] = "titleTextSize";
|
|
19
20
|
ANDROID_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
|
|
20
21
|
ANDROID_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
|
|
22
|
+
ANDROID_THEME_CONFIG_KEY["bodyTextSize"] = "bodyTextSize";
|
|
21
23
|
ANDROID_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
|
|
22
24
|
ANDROID_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
|
|
23
25
|
// formLabelTextColor = "formLabelTextColor",
|
|
@@ -51,9 +53,11 @@ var IOS_THEME_CONFIG_KEY;
|
|
|
51
53
|
IOS_THEME_CONFIG_KEY["overlayBackgroundColor"] = "overlayBackgroundColor";
|
|
52
54
|
IOS_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
|
|
53
55
|
IOS_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
|
|
56
|
+
IOS_THEME_CONFIG_KEY["titleTextSize"] = "titleTextSize";
|
|
54
57
|
IOS_THEME_CONFIG_KEY["titleTextAlignment"] = "titleTextAlignment";
|
|
55
58
|
IOS_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
|
|
56
59
|
IOS_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
|
|
60
|
+
IOS_THEME_CONFIG_KEY["bodyTextSize"] = "bodyTextSize";
|
|
57
61
|
IOS_THEME_CONFIG_KEY["bodyTextAlignment"] = "bodyTextAlignment";
|
|
58
62
|
IOS_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
|
|
59
63
|
IOS_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
|
package/persona-tools/Theme.ts
CHANGED
|
@@ -13,9 +13,11 @@ export enum ANDROID_THEME_CONFIG_KEY {
|
|
|
13
13
|
|
|
14
14
|
titleTextColor = "titleTextColor",
|
|
15
15
|
titleTextFont = "titleTextFont",
|
|
16
|
+
titleTextSize = "titleTextSize",
|
|
16
17
|
|
|
17
18
|
bodyTextColor = "bodyTextColor",
|
|
18
19
|
bodyTextFont = "bodyTextFont",
|
|
20
|
+
bodyTextSize = "bodyTextSize",
|
|
19
21
|
|
|
20
22
|
footnoteTextColor = "footnoteTextColor",
|
|
21
23
|
footnoteTextFont = "footnoteTextFont",
|
|
@@ -54,9 +56,11 @@ export enum IOS_THEME_CONFIG_KEY {
|
|
|
54
56
|
overlayBackgroundColor = "overlayBackgroundColor",
|
|
55
57
|
titleTextColor = "titleTextColor",
|
|
56
58
|
titleTextFont = "titleTextFont",
|
|
59
|
+
titleTextSize = "titleTextSize",
|
|
57
60
|
titleTextAlignment = "titleTextAlignment",
|
|
58
61
|
bodyTextColor = "bodyTextColor",
|
|
59
62
|
bodyTextFont = "bodyTextFont",
|
|
63
|
+
bodyTextSize = "bodyTextSize",
|
|
60
64
|
bodyTextAlignment = "bodyTextAlignment",
|
|
61
65
|
footnoteTextColor = "footnoteTextColor",
|
|
62
66
|
footnoteTextFont = "footnoteTextFont",
|
|
@@ -126,7 +126,7 @@ class AndroidResourcePrinter {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
titleText() {
|
|
129
|
-
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
129
|
+
if (this.theme.titleTextColor || this.theme.titleTextSize || this.theme.titleTextFont) {
|
|
130
130
|
this.printQueue.push(() => {
|
|
131
131
|
this.root = this.root
|
|
132
132
|
.ele("item", { name: "personaTitleTextAppearance" })
|
|
@@ -155,9 +155,10 @@ class AndroidResourcePrinter {
|
|
|
155
155
|
}
|
|
156
156
|
// Default values taken from `Persona.Text.Title`
|
|
157
157
|
// in shared/src/main/res/values/styles.xml
|
|
158
|
+
const textSize = this.theme.titleTextSize ? `${this.theme.titleTextSize}sp` : "26sp";
|
|
158
159
|
this.root = this.root
|
|
159
160
|
.ele("item", { name: "android:textSize" })
|
|
160
|
-
.txt(
|
|
161
|
+
.txt(textSize)
|
|
161
162
|
.up()
|
|
162
163
|
.ele("item", { name: "android:textStyle" })
|
|
163
164
|
.txt("bold")
|
|
@@ -175,7 +176,7 @@ class AndroidResourcePrinter {
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
bodyText() {
|
|
178
|
-
if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
|
|
179
|
+
if (this.theme.bodyTextColor || this.theme.bodyTextSize || this.theme.bodyTextFont) {
|
|
179
180
|
this.printQueue.push(() => {
|
|
180
181
|
this.root = this.root
|
|
181
182
|
.ele("item", { name: "personaBodyTextAppearance" })
|
|
@@ -204,10 +205,12 @@ class AndroidResourcePrinter {
|
|
|
204
205
|
}
|
|
205
206
|
// Default values taken from `Persona.Text.Body`
|
|
206
207
|
// in shared/src/main/res/values/styles.xml
|
|
208
|
+
const textSize = this.theme.bodyTextSize ? `${this.theme.bodyTextSize}sp` : "18sp";
|
|
207
209
|
this.root = this.root
|
|
208
210
|
.ele("item", { name: "android:textSize" })
|
|
209
|
-
.txt(
|
|
211
|
+
.txt(textSize)
|
|
210
212
|
.up();
|
|
213
|
+
|
|
211
214
|
this.root = this.root.up();
|
|
212
215
|
});
|
|
213
216
|
}
|
|
@@ -11,8 +11,10 @@ const EMPTY_THEME = {
|
|
|
11
11
|
accentColor: null,
|
|
12
12
|
titleTextColor: null,
|
|
13
13
|
titleTextFont: null,
|
|
14
|
+
titleTextSize: null,
|
|
14
15
|
bodyTextColor: null,
|
|
15
16
|
bodyTextFont: null,
|
|
17
|
+
bodyTextSize: null,
|
|
16
18
|
footnoteTextColor: null,
|
|
17
19
|
footnoteTextFont: null,
|
|
18
20
|
// formLabelTextColor: null,
|
|
@@ -8,8 +8,10 @@ const EMPTY_THEME: AndroidThemeObject = {
|
|
|
8
8
|
accentColor: null,
|
|
9
9
|
titleTextColor: null,
|
|
10
10
|
titleTextFont: null,
|
|
11
|
+
titleTextSize: null,
|
|
11
12
|
bodyTextColor: null,
|
|
12
13
|
bodyTextFont: null,
|
|
14
|
+
bodyTextSize: null,
|
|
13
15
|
footnoteTextColor: null,
|
|
14
16
|
footnoteTextFont: null,
|
|
15
17
|
// formLabelTextColor: null,
|
|
@@ -800,8 +802,10 @@ it("fullTheme", () => {
|
|
|
800
802
|
accentColor: "#FF0000",
|
|
801
803
|
titleTextColor: "#FF0000",
|
|
802
804
|
titleTextFont: "Arial",
|
|
805
|
+
titleTextSize: "40",
|
|
803
806
|
bodyTextColor: "#FF0000",
|
|
804
807
|
bodyTextFont: "Arial",
|
|
808
|
+
bodyTextSize: "4",
|
|
805
809
|
footnoteTextColor: "#FF0000",
|
|
806
810
|
footnoteTextFont: "Arial",
|
|
807
811
|
// formLabelTextColor: "#FF0000",
|
|
@@ -869,13 +873,13 @@ it("fullTheme", () => {
|
|
|
869
873
|
<style name=\\"RN.Persona.Text.Title\\" parent=\\"Persona.Text.Body\\">
|
|
870
874
|
<item name=\\"android:textColor\\">#FF0000</item>
|
|
871
875
|
<item name=\\"android:fontFamily\\">Arial</item>
|
|
872
|
-
<item name=\\"android:textSize\\">
|
|
876
|
+
<item name=\\"android:textSize\\">40sp</item>
|
|
873
877
|
<item name=\\"android:textStyle\\">bold</item>
|
|
874
878
|
</style>
|
|
875
879
|
<style name=\\"RN.Persona.Text.Body\\" parent=\\"Persona.Text.Body\\">
|
|
876
880
|
<item name=\\"android:textColor\\">#FF0000</item>
|
|
877
881
|
<item name=\\"android:fontFamily\\">Arial</item>
|
|
878
|
-
<item name=\\"android:textSize\\">
|
|
882
|
+
<item name=\\"android:textSize\\">4sp</item>
|
|
879
883
|
</style>
|
|
880
884
|
<style name=\\"TextAppearance.AppCompat.Small\\">
|
|
881
885
|
<item name=\\"android:textSize\\">@dimen/abc_text_size_small_material</item>
|
|
@@ -145,7 +145,7 @@ class AndroidResourcePrinter {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
private titleText() {
|
|
148
|
-
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
148
|
+
if (this.theme.titleTextColor || this.theme.titleTextSize || this.theme.titleTextFont) {
|
|
149
149
|
this.printQueue.push(() => {
|
|
150
150
|
this.root = this.root
|
|
151
151
|
.ele("item", { name: "personaTitleTextAppearance" })
|
|
@@ -178,9 +178,10 @@ class AndroidResourcePrinter {
|
|
|
178
178
|
|
|
179
179
|
// Default values taken from `Persona.Text.Title`
|
|
180
180
|
// in shared/src/main/res/values/styles.xml
|
|
181
|
+
const textSize = this.theme.titleTextSize ? `${this.theme.titleTextSize}sp` : "26sp";
|
|
181
182
|
this.root = this.root
|
|
182
183
|
.ele("item", { name: "android:textSize" })
|
|
183
|
-
.txt(
|
|
184
|
+
.txt(textSize)
|
|
184
185
|
.up()
|
|
185
186
|
.ele("item", { name: "android:textStyle" })
|
|
186
187
|
.txt("bold")
|
|
@@ -199,7 +200,7 @@ class AndroidResourcePrinter {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
private bodyText() {
|
|
202
|
-
if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
|
|
203
|
+
if (this.theme.bodyTextColor || this.theme.bodyTextSize || this.theme.bodyTextFont) {
|
|
203
204
|
this.printQueue.push(() => {
|
|
204
205
|
this.root = this.root
|
|
205
206
|
.ele("item", { name: "personaBodyTextAppearance" })
|
|
@@ -230,11 +231,10 @@ class AndroidResourcePrinter {
|
|
|
230
231
|
.up();
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
// in shared/src/main/res/values/styles.xml
|
|
234
|
+
const textSize = this.theme.titleTextSize ? `${this.theme.bodyTextSize}sp` : "18sp";
|
|
235
235
|
this.root = this.root
|
|
236
236
|
.ele("item", { name: "android:textSize" })
|
|
237
|
-
.txt(
|
|
237
|
+
.txt(textSize)
|
|
238
238
|
.up();
|
|
239
239
|
|
|
240
240
|
this.root = this.root.up();
|