react-native-tinyui 0.2.0 → 0.3.0
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.
|
@@ -253,30 +253,21 @@ private struct TinyuiMenuLabel: View {
|
|
|
253
253
|
return AnyView(EmptyView())
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
VStack(alignment: .leading, spacing: 1) {
|
|
261
|
-
titleText
|
|
262
|
-
Text(subtitle)
|
|
263
|
-
.font(.caption)
|
|
264
|
-
.foregroundStyle(.secondary)
|
|
265
|
-
}
|
|
266
|
-
} else {
|
|
267
|
-
titleText
|
|
256
|
+
private var title: Text {
|
|
257
|
+
let title = dictionary["title"] as? String ?? ""
|
|
258
|
+
let subtitle = (dictionary["subtitle"] as? String).flatMap {
|
|
259
|
+
$0.isEmpty ? nil : $0
|
|
268
260
|
}
|
|
269
|
-
|
|
261
|
+
let text = subtitle.map { subtitle in
|
|
262
|
+
Text("\(title)\n\(subtitle)")
|
|
263
|
+
} ?? Text(title)
|
|
270
264
|
|
|
271
|
-
@ViewBuilder
|
|
272
|
-
private var titleText: some View {
|
|
273
|
-
let text = Text(dictionary["title"] as? String ?? "")
|
|
274
265
|
if destructive {
|
|
275
|
-
text.
|
|
266
|
+
return text.foregroundColor(.red)
|
|
276
267
|
} else if let color = TinyuiMenuColor.uiColor(from: dictionary["titleColor"]) {
|
|
277
|
-
text.
|
|
268
|
+
return text.foregroundColor(Color(uiColor: color))
|
|
278
269
|
} else {
|
|
279
|
-
text
|
|
270
|
+
return text
|
|
280
271
|
}
|
|
281
272
|
}
|
|
282
273
|
|
package/package.json
CHANGED