fix(mobile): dim disabled switches on Android

Android kept the custom colors of a disabled switch, so a list's locked
Private Follow and Hide from Timeline switches looked usable to free users
and did nothing when tapped. A disabled switch is now dimmed on Android, as
iOS already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DIYgod
2026-10-12 22:55:11 +08:00
parent f6d29f06e3
commit 8f7bafb342
@@ -59,7 +59,11 @@ export const Switch = ({
ios_backgroundColor={gray4}
onChange={onChange ?? undefined}
onValueChange={onValueChange ?? undefined}
style={size === "sm" ? styles.small : styles.default}
style={[
size === "sm" ? styles.small : styles.default,
// iOS dims a disabled switch, but Android keeps the custom colors, so it would look enabled
disabled && Platform.OS === "android" && styles.disabledAndroid,
]}
testID={testID}
accessibilityLabel={accessibilityLabel ?? cellLabel}
thumbColor={Platform.OS === "android" ? "#FFFFFF" : undefined}
@@ -76,4 +80,7 @@ const styles = StyleSheet.create({
small: {
transform: [{ scaleX: 0.8 }, { scaleY: 0.8 }],
},
disabledAndroid: {
opacity: 0.5,
},
})