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
- @ViewBuilder
257
- private var title: some View {
258
- if let subtitle = dictionary["subtitle"] as? String,
259
- !subtitle.isEmpty {
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.foregroundStyle(Color.red)
266
+ return text.foregroundColor(.red)
276
267
  } else if let color = TinyuiMenuColor.uiColor(from: dictionary["titleColor"]) {
277
- text.foregroundStyle(Color(uiColor: color))
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tinyui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Dependency-free native iOS Menu and Popover components for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",