@momo-kits/native-kits 0.151.2-test.6 → 0.151.2-test.7

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.
@@ -43,26 +43,23 @@ public struct Button: View {
43
43
  public var body: some View {
44
44
  SwiftUI.Button(action: action) {
45
45
  HStack {
46
- if (loading) {
47
- LottieView(
48
- name: "lottie_circle_loader",
49
- loopMode: .loop,
50
- contentMode: .center
51
- )
52
- .frame(width: 32, height: 32)
53
- .foregroundColor(.white)
54
- .colorMultiply(.white)
55
- } else {
56
- iconLeft
46
+ if loading {
47
+ LottieView(name: "lottie_circle_loader", loopMode: .loop)
48
+ .frame(width: iconSize, height: iconSize)
49
+ .colorMultiply(.white)
50
+ } else if let iconLeft = iconLeft {
51
+ iconLeft.frame(width: iconSize, height: iconSize)
57
52
  }
58
53
  renderTitle(title: title, type: type, size: size).lineLimit(1).truncationMode(.tail)
59
- iconRight
54
+ if let iconRight = iconRight {
55
+ iconRight.frame(width: iconSize, height: iconSize)
56
+ }
60
57
  }
61
58
  .buttonSize(size)
62
59
  .buttonType(type)
63
60
  .opacity(loading ? 0.75 : 1.0)
64
61
  }
65
- .disabled(type == .disabled && !loading)
62
+ .disabled(type == .disabled || loading)
66
63
  .clipShape(RoundedRectangle(cornerRadius: Radius.S))
67
64
  }
68
65
 
@@ -75,6 +72,14 @@ public struct Button: View {
75
72
  var iconLeft: AnyView?
76
73
  var iconRight: AnyView?
77
74
  var loading: Bool
75
+
76
+ private var iconSize: CGFloat {
77
+ switch size {
78
+ case .large: return 24
79
+ case .medium: return 16
80
+ case .small: return 16
81
+ }
82
+ }
78
83
 
79
84
  func renderTitle(title: String, type: ButtonType, size: ButtonSize) -> Text {
80
85
  switch size {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.151.2-test.6",
3
+ "version": "0.151.2-test.7",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@momo-platform/native-max-api": "1.0.18"