@momo-kits/native-kits 0.151.2-test.13 → 0.151.2-test.15

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.
@@ -110,7 +110,7 @@ fun getIconSpace(size: Size): Dp {
110
110
  fun getTextColor(loading: Boolean, type: ButtonType): Color {
111
111
  val theme = AppTheme.current
112
112
 
113
- return remember(type, theme) {
113
+ return remember(type, theme, loading) {
114
114
  when (type) {
115
115
  ButtonType.DISABLED -> theme.colors.text.disable
116
116
  ButtonType.PRIMARY -> Colors.black_01
@@ -199,7 +199,7 @@ fun getTypeStyle(
199
199
  val radius = remember(size) { size.value.radius }
200
200
  val modifier = Modifier.background(bgColor)
201
201
 
202
- return remember(type, color, theme, radius) {
202
+ return remember(type, color, theme, radius, bgColor) {
203
203
  when (type) {
204
204
  ButtonType.DISABLED -> modifier
205
205
  .border(0.dp, Color.Unspecified, RoundedCornerShape(radius))
@@ -235,14 +235,16 @@ fun getButtonBackgroundColor(
235
235
  ): Color {
236
236
  val theme = AppTheme.current
237
237
 
238
- return when (type) {
239
- ButtonType.DISABLED -> theme.colors.background.disable.withLoading(loading)
240
- ButtonType.PRIMARY -> theme.colors.primary.withLoading(loading)
241
- ButtonType.SECONDARY -> theme.colors.background.surface.withLoading(loading)
242
- ButtonType.OUTLINE -> theme.colors.background.surface.withLoading(loading)
243
- ButtonType.TONAL -> theme.colors.background.tonal.withLoading(loading)
244
- ButtonType.DANGER -> theme.colors.error.primary.withLoading(loading)
245
- ButtonType.TEXT -> Color.Unspecified
238
+ return remember(loading, type, theme) {
239
+ when (type) {
240
+ ButtonType.DISABLED -> theme.colors.background.disable.withLoading(loading)
241
+ ButtonType.PRIMARY -> theme.colors.primary.withLoading(loading)
242
+ ButtonType.SECONDARY -> theme.colors.background.surface.withLoading(loading)
243
+ ButtonType.OUTLINE -> theme.colors.background.surface.withLoading(loading)
244
+ ButtonType.TONAL -> theme.colors.background.tonal.withLoading(loading)
245
+ ButtonType.DANGER -> theme.colors.error.primary.withLoading(loading)
246
+ ButtonType.TEXT -> Color.Unspecified
247
+ }
246
248
  }
247
249
  }
248
250
 
@@ -83,51 +83,44 @@ actual fun LottieAnimation(
83
83
  }
84
84
 
85
85
  else -> {
86
- val factory = remember {
87
- {
88
- CompatibleAnimationView(value).also {
89
- it.translatesAutoresizingMaskIntoConstraints = true
90
- it.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.whiteColor)
91
- it.setLoopAnimationCount(-1.0)
92
- it.setAnimationSpeed(1.0)
86
+ Box(modifier) {
87
+ UIKitView(
88
+ modifier = Modifier.fillMaxSize(),
89
+ factory = {
90
+ CompatibleAnimationView(value).apply {
91
+ translatesAutoresizingMaskIntoConstraints = true
93
92
 
94
- if (tintColor != null) {
95
- val uiColor = tintColor.toUIColor()
93
+ setBackgroundColor(bgColor?.toUIColor() ?: UIColor.whiteColor)
94
+
95
+ setLoopAnimationCount(-1.0)
96
+ setAnimationSpeed(1.0)
96
97
 
97
- it.setColorValue(
98
- uiColor,
99
- CompatibleAnimationKeypath("**.Fill 1.Color")
100
- )
101
- it.setColorValue(
102
- uiColor,
103
- CompatibleAnimationKeypath("**.Fill.Color")
104
- )
105
- it.setColorValue(
106
- uiColor,
107
- CompatibleAnimationKeypath("**.Color")
108
- )
109
-
110
- it.setColorValue(
111
- uiColor,
112
- CompatibleAnimationKeypath("**.Stroke 1.Color")
113
- )
114
- it.setColorValue(
115
- uiColor,
116
- CompatibleAnimationKeypath("**.Stroke.Color")
117
- )
98
+ if (tintColor != null) {
99
+ val uiColor = tintColor.toUIColor()
100
+ setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill 1.Color"))
101
+ setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
102
+ setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
103
+ setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
104
+ setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
105
+ }
106
+
107
+ play()
118
108
  }
109
+ },
119
110
 
111
+ update = { view ->
112
+ view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.whiteColor)
120
113
 
114
+ if (tintColor != null) {
115
+ val uiColor = tintColor.toUIColor()
121
116
 
122
- it.play()
117
+ view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill 1.Color"))
118
+ view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Fill.Color"))
119
+ view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Color"))
120
+ view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke 1.Color"))
121
+ view.setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
122
+ }
123
123
  }
124
- }
125
- }
126
-
127
- Box(modifier) {
128
- UIKitView(
129
- modifier = Modifier.fillMaxSize(),
130
- factory = factory,
131
124
  )
132
125
  }
133
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.151.2-test.13",
3
+ "version": "0.151.2-test.15",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@momo-platform/native-max-api": "1.0.18"