Skip to content

Commit bf14c2b

Browse files
committed
library: Fix Button color change
1 parent 5fb9ab1 commit bf14c2b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

iosApp/iosApp/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundleShortVersionString</key>
1818
<string>1.0.4</string>
1919
<key>CFBundleVersion</key>
20-
<string>495</string>
20+
<string>496</string>
2121
<key>LSRequiresIPhoneOS</key>
2222
<true/>
2323
<key>CADisableMinimumFrameDurationOnPhone</key>

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import androidx.compose.foundation.layout.defaultMinSize
1111
import androidx.compose.foundation.layout.padding
1212
import androidx.compose.runtime.Composable
1313
import androidx.compose.runtime.Immutable
14+
import androidx.compose.runtime.getValue
1415
import androidx.compose.runtime.remember
16+
import androidx.compose.runtime.rememberUpdatedState
1517
import androidx.compose.ui.Alignment
1618
import androidx.compose.ui.Modifier
1719
import androidx.compose.ui.graphics.Color
@@ -49,7 +51,7 @@ fun Button(
4951
content: @Composable RowScope.() -> Unit
5052
) {
5153
val shape = remember(cornerRadius) { SmoothRoundedCornerShape(cornerRadius) }
52-
val color = remember(enabled) { if (enabled) colors.color else colors.disabledColor }
54+
val color by rememberUpdatedState(if (enabled) colors.color else colors.disabledColor)
5355
Surface(
5456
onClick = onClick,
5557
enabled = enabled,
@@ -94,8 +96,8 @@ fun TextButton(
9496
insideMargin: PaddingValues = ButtonDefaults.InsideMargin
9597
) {
9698
val shape = remember(cornerRadius) { SmoothRoundedCornerShape(cornerRadius) }
97-
val color = remember(enabled) { if (enabled) colors.color else colors.disabledColor }
98-
val textColor = remember(enabled) { if (enabled) colors.textColor else colors.disabledTextColor }
99+
val color by rememberUpdatedState(if (enabled) colors.color else colors.disabledColor)
100+
val textColor by rememberUpdatedState(if (enabled) colors.textColor else colors.disabledTextColor)
99101
Surface(
100102
onClick = onClick,
101103
enabled = enabled,

0 commit comments

Comments
 (0)