@momo-kits/native-kits 0.113.1-beta.2 → 0.113.1-beta.4

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.
@@ -20,13 +20,13 @@ public struct Screen<Content: View>: View {
20
20
  var onContentLayout: ((CGRect) -> Void)?
21
21
  var useAvoidKeyboard: Bool
22
22
  var footer: (() -> AnyView)?
23
- var headerRight: (() -> AnyView)?
23
+ var headerRight: (()->any View)? = {HeaderRight()}
24
24
  var animatedHeader: AnimatedHeader? = nil
25
25
  var layoutOffset: CGFloat
26
26
  var inputSearchProps: InputSearchProps? = nil
27
27
  var fabProps: FabProps? = nil
28
28
  var content: () -> Content
29
-
29
+
30
30
  public init(
31
31
  backgroundColor: Color? = nil,
32
32
  isBack: Bool = true,
@@ -40,7 +40,7 @@ public struct Screen<Content: View>: View {
40
40
  onContentLayout: ((CGRect) -> Void)? = nil,
41
41
  useAvoidKeyboard: Bool = true,
42
42
  footer: (() -> AnyView)? = nil,
43
- headerRight: (() -> AnyView)? = nil,
43
+ headerRight: (()->any View)? = {HeaderRight()},
44
44
  animatedHeader: AnimatedHeader? = nil,
45
45
  layoutOffset: CGFloat = 56,
46
46
  inputSearchProps: InputSearchProps? = nil,
@@ -66,19 +66,19 @@ public struct Screen<Content: View>: View {
66
66
  self.fabProps = fabProps
67
67
  self.content = content
68
68
  }
69
-
69
+
70
70
  @State private var scrollOffset: CGFloat = 0
71
-
71
+
72
72
  public var body: some View {
73
73
  GeometryReader { geometry in
74
74
  let safeAreaInsets = geometry.safeAreaInsets
75
75
  let statusBarHeight = safeAreaInsets.top
76
76
  let keyboardHeight: CGFloat = 0
77
77
  let keyboardSize: CGFloat = useAvoidKeyboard ? max(keyboardHeight, 0) : 0
78
-
78
+
79
79
  ZStack {
80
80
  (backgroundColor ?? Color.white).edgesIgnoringSafeArea(.all)
81
-
81
+
82
82
  VStack(spacing: 0) {
83
83
  ZStack {
84
84
  if animatedHeader == nil {
@@ -86,9 +86,9 @@ public struct Screen<Content: View>: View {
86
86
  } else {
87
87
  Color.white.opacity(Double(min(scrollOffset / 114, 1)))
88
88
  .overlay(HeaderBackground(headerType: headerType, scrollState: scrollOffset))
89
-
89
+
90
90
  }
91
-
91
+
92
92
  Header(
93
93
  headerType: headerType,
94
94
  titlePosition: titlePosition,
@@ -101,13 +101,13 @@ public struct Screen<Content: View>: View {
101
101
  inputSearchProps: inputSearchProps
102
102
  ).padding(.bottom, headerType == .extended ? 0 : -safeAreaTopInset())
103
103
  }.padding(.top, -safeAreaTopInset())
104
-
105
-
104
+
105
+
106
106
  VStack(alignment: horizontalAlignment, spacing: 0) {
107
107
  if animatedHeader != nil {
108
108
  Spacer().frame(height: statusBarHeight + 52 + layoutOffset)
109
109
  }
110
-
110
+
111
111
  if scrollable {
112
112
  ScrollView(.vertical, showsIndicators: false) {
113
113
  VStack {
@@ -125,19 +125,19 @@ public struct Screen<Content: View>: View {
125
125
  }
126
126
  }
127
127
  .padding(.bottom, keyboardSize)
128
-
129
-
128
+
129
+
130
130
  if let footerView = footer?() {
131
131
  ZStack(alignment: .top) {
132
132
  Rectangle()
133
133
  .fill(Colors.black20)
134
134
  .frame(height: 4)
135
135
  .shadow(color: Colors.black20.opacity(0.2), radius: 10, x: 0, y: -2)
136
-
136
+
137
137
  Footer(footerView: footerView, keyboardSize: keyboardSize)
138
138
  }
139
139
  }
140
-
140
+
141
141
  if let fabProps = fabProps {
142
142
  FloatingButton(
143
143
  scrollOffset: scrollOffset,
@@ -154,7 +154,7 @@ public struct Screen<Content: View>: View {
154
154
  )
155
155
  }
156
156
  }
157
-
157
+
158
158
  }
159
159
  }
160
160
  }
@@ -163,7 +163,7 @@ public struct Screen<Content: View>: View {
163
163
  struct Footer: View {
164
164
  var footerView: AnyView
165
165
  var keyboardSize: CGFloat
166
-
166
+
167
167
  var body: some View {
168
168
  VStack {
169
169
  footerView
@@ -172,4 +172,3 @@ struct Footer: View {
172
172
  .background(Colors.black01)
173
173
  }
174
174
  }
175
-
@@ -0,0 +1,31 @@
1
+ import SwiftUI
2
+
3
+ public enum DotSize {
4
+ case small
5
+ case large
6
+
7
+ var size: CGFloat {
8
+ switch self {
9
+ case .small: return 10
10
+ case .large: return 16
11
+ }
12
+ }
13
+ }
14
+
15
+ public struct BadgeDot: View {
16
+ var size: DotSize
17
+
18
+ public init(size: DotSize = .large) {
19
+ self.size = size
20
+ }
21
+
22
+ public var body: some View {
23
+ Circle()
24
+ .fill(Colors.red03)
25
+ .frame(width: size.size, height: size.size)
26
+ .overlay(
27
+ Circle()
28
+ .stroke(Colors.black01, lineWidth: 1)
29
+ )
30
+ }
31
+ }
@@ -98,8 +98,9 @@ private extension View {
98
98
  case .secondary:
99
99
  return AnyView(self
100
100
  .background(Colors.card)
101
- .foregroundColor(Colors.primary)
101
+ .foregroundColor(Colors.text)
102
102
  .cornerRadius(8)
103
+ .overlay(RoundedRectangle(cornerRadius: Radius.S).stroke(Colors.black06, lineWidth: 1))
103
104
  .padding(2)
104
105
  )
105
106
  case .outline:
@@ -44,9 +44,7 @@ public struct Icon: View {
44
44
 
45
45
  public var body: some View {
46
46
  if let uri = iconSources[source]?.uri {
47
- ImageView(uri)
48
- .frame(width: size, height: size)
49
- .foregroundColor(color)
47
+ ImageView(uri, color: color).frame(width: size, height: size)
50
48
  }
51
49
  }
52
50
  }
@@ -8,11 +8,12 @@ import SwiftUI
8
8
  public struct ImageView: View {
9
9
  // MARK: Lifecycle
10
10
 
11
- public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil) {
11
+ public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil, color: Color? = nil) {
12
12
  self.url = url
13
13
  self.aspectRatio = aspectRatio
14
14
  self.contentMode = contentMode
15
15
  self.placeholder = placeholder
16
+ self.color = color
16
17
  }
17
18
 
18
19
  // MARK: Public
@@ -26,6 +27,7 @@ public struct ImageView: View {
26
27
  error = false
27
28
  }
28
29
  .resizable()
30
+ .renderingMode(.template)
29
31
  .placeholder {
30
32
  Rectangle().foregroundColor(.gray)
31
33
  VStack(alignment: .center, content: {
@@ -47,6 +49,7 @@ public struct ImageView: View {
47
49
  .scaledToFit()
48
50
  .transition(.fade)
49
51
  .aspectRatio(aspectRatio, contentMode: contentMode)
52
+ .modifier(ColorMultiplyModifier(color: color))
50
53
  }
51
54
 
52
55
  // MARK: Internal
@@ -54,7 +57,20 @@ public struct ImageView: View {
54
57
  var aspectRatio: CGFloat?
55
58
  var contentMode: ContentMode
56
59
  var placeholder: AnyView?
60
+ var color: Color?
57
61
 
58
62
  @State var error: Bool = false
59
63
  var url: String
60
64
  }
65
+
66
+ private struct ColorMultiplyModifier: ViewModifier {
67
+ let color: Color?
68
+
69
+ func body(content: Content) -> some View {
70
+ if let color {
71
+ content.colorMultiply(color)
72
+ } else {
73
+ content
74
+ }
75
+ }
76
+ }
@@ -43,7 +43,6 @@ public struct PopupDisplay: View {
43
43
  Image(systemName: "xmark.circle.fill")
44
44
  .resizable()
45
45
  .frame(width: 16, height: 16)
46
- .overlay(RoundedRectangle(cornerRadius: Radius.S).stroke(Colors.black01, lineWidth: 1))
47
46
  }.foregroundColor(Colors.black20)
48
47
  .background(Colors.black01.cornerRadius(8))
49
48
  .offset(x: 6, y: -6)
@@ -53,17 +52,15 @@ public struct PopupDisplay: View {
53
52
  WebImage(url: URL(string: url), isAnimating: .constant(true))
54
53
  .resizable()
55
54
  .scaledToFill()
56
- .frame(maxWidth: .infinity)
55
+ .frame(maxWidth: .infinity, maxHeight: 164)
57
56
  .clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .topRight]))
58
- .aspectRatio(2, contentMode: .fit)
59
57
 
60
58
  VStack(alignment: .leading) {
61
59
  Text(title)
62
60
  .foregroundColor(.black)
63
- .font(.title3)
64
- .padding(.top, 16)
65
- .padding(.bottom, 8)
66
- .lineLimit(2)
61
+ .font(.headerText1)
62
+ .padding(.top, 12)
63
+ .padding(.bottom, 24)
67
64
 
68
65
  Text(description)
69
66
  .foregroundColor(.black)
@@ -90,8 +87,10 @@ public struct PopupDisplay: View {
90
87
  }.clipped()
91
88
  }
92
89
  }
93
- .background(Color.white.cornerRadius(15))
94
- .padding(.horizontal, 24)
90
+ .background(Color.white.cornerRadius(8))
91
+ .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
92
+ .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
93
+ .padding(.horizontal, 40)
95
94
  }
96
95
 
97
96
  // MARK: Internal
package/local.properties CHANGED
@@ -4,5 +4,5 @@
4
4
  # Location of the SDK. This is only used by Gradle.
5
5
  # For customization when using a Version Control System, please read the
6
6
  # header note.
7
- #Thu Jan 09 10:43:10 ICT 2025
8
- sdk.dir=/Users/sophia/Library/Android/sdk
7
+ #Wed Aug 21 14:20:12 ICT 2024
8
+ sdk.dir=/Users/huynhdung/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.113.1-beta.2",
3
+ "version": "0.113.1-beta.4",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},