@momo-kits/native-kits 0.153.1-beta.5 → 0.153.1-beta.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.
@@ -1,5 +1,74 @@
1
1
  import SwiftUI
2
2
 
3
+ // MARK: - Custom Shape for Rounded Corners
4
+ struct RoundedCorners: Shape {
5
+ var topLeft: CGFloat = 0.0
6
+ var topRight: CGFloat = 0.0
7
+ var bottomLeft: CGFloat = 0.0
8
+ var bottomRight: CGFloat = 0.0
9
+
10
+ func path(in rect: CGRect) -> Path {
11
+ var path = Path()
12
+
13
+ let width = rect.size.width
14
+ let height = rect.size.height
15
+
16
+ // Start from top left
17
+ path.move(to: CGPoint(x: topLeft, y: 0))
18
+
19
+ // Top edge and top right corner
20
+ path.addLine(to: CGPoint(x: width - topRight, y: 0))
21
+ if topRight > 0 {
22
+ path.addArc(
23
+ center: CGPoint(x: width - topRight, y: topRight),
24
+ radius: topRight,
25
+ startAngle: Angle(degrees: -90),
26
+ endAngle: Angle(degrees: 0),
27
+ clockwise: false
28
+ )
29
+ }
30
+
31
+ // Right edge and bottom right corner
32
+ path.addLine(to: CGPoint(x: width, y: height - bottomRight))
33
+ if bottomRight > 0 {
34
+ path.addArc(
35
+ center: CGPoint(x: width - bottomRight, y: height - bottomRight),
36
+ radius: bottomRight,
37
+ startAngle: Angle(degrees: 0),
38
+ endAngle: Angle(degrees: 90),
39
+ clockwise: false
40
+ )
41
+ }
42
+
43
+ // Bottom edge and bottom left corner
44
+ path.addLine(to: CGPoint(x: bottomLeft, y: height))
45
+ if bottomLeft > 0 {
46
+ path.addArc(
47
+ center: CGPoint(x: bottomLeft, y: height - bottomLeft),
48
+ radius: bottomLeft,
49
+ startAngle: Angle(degrees: 90),
50
+ endAngle: Angle(degrees: 180),
51
+ clockwise: false
52
+ )
53
+ }
54
+
55
+ // Left edge and top left corner
56
+ path.addLine(to: CGPoint(x: 0, y: topLeft))
57
+ if topLeft > 0 {
58
+ path.addArc(
59
+ center: CGPoint(x: topLeft, y: topLeft),
60
+ radius: topLeft,
61
+ startAngle: Angle(degrees: 180),
62
+ endAngle: Angle(degrees: 270),
63
+ clockwise: false
64
+ )
65
+ }
66
+
67
+ path.closeSubpath()
68
+ return path
69
+ }
70
+ }
71
+
3
72
  public enum RibbonPosition {
4
73
  case topLeft
5
74
  case topRight
@@ -76,14 +145,13 @@ public struct BadgeRibbon: View {
76
145
  .frame(height: RibbonConstants.roundHeight)
77
146
  .padding(.trailing, RibbonConstants.roundPaddingEnd)
78
147
  .background(
79
- RoundedRectangle(cornerRadius: Radius.M)
80
- .fill(backgroundColor)
81
- .mask(
82
- HStack(spacing: 0) {
83
- Rectangle()
84
- RoundedRectangle(cornerRadius: Radius.M)
85
- }
86
- )
148
+ RoundedCorners(
149
+ topLeft: 0,
150
+ topRight: RibbonConstants.roundRightRadius,
151
+ bottomLeft: 0,
152
+ bottomRight: RibbonConstants.roundRightRadius
153
+ )
154
+ .fill(backgroundColor)
87
155
  )
88
156
  }
89
157
 
@@ -139,7 +207,7 @@ private struct RibbonConstants {
139
207
  static let ribbonHeight: CGFloat = 20
140
208
  static let roundHeight: CGFloat = 16
141
209
  static let skewBodyHeight: CGFloat = 16
142
- static let roundRightRadius: CGFloat = 12
210
+ static let roundRightRadius: CGFloat = 8
143
211
  static let roundPaddingEnd: CGFloat = 6
144
212
  static let skewTailWidth: CGFloat = 8
145
213
  static let skewTailHeight: CGFloat = 16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.153.1-beta.5",
3
+ "version": "0.153.1-beta.7",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@momo-platform/native-max-api": "1.0.18"
@@ -1,26 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import kotlinx.coroutines.flow.MutableStateFlow
4
- import kotlinx.coroutines.flow.asStateFlow
5
-
6
- // Support swipe back on iOS
7
- object ComposeNavigatorManager {
8
- private val _managers = MutableStateFlow<List<Navigator>>(emptyList())
9
- val managers = _managers.asStateFlow()
10
-
11
- fun push(manager: Navigator) {
12
- _managers.value = _managers.value + manager
13
- }
14
-
15
- fun removeLast() {
16
- _managers.value = _managers.value.dropLast(1)
17
- }
18
-
19
- fun checkCanPop(): Boolean = _managers.value.isNotEmpty()
20
-
21
- fun pop() {
22
- top()?.pop()
23
- }
24
-
25
- private fun top(): Navigator? = _managers.value.lastOrNull()
26
- }