fix: SlideToConfirm color prop + TS errors that were crashing Metro bundler

This commit is contained in:
Nemo
2026-03-24 16:25:48 +08:00
parent 2325d5ad62
commit 77a395a2ef

View File

@@ -17,12 +17,13 @@ interface Props {
label?: string;
disabled?: boolean;
style?: ViewStyle;
color?: string;
}
const HANDLE_SIZE = 56;
const THRESHOLD = 0.80;
export function SlideToConfirm({ onConfirm, label = 'Slide to confirm', disabled = false, style }: Props) {
export function SlideToConfirm({ onConfirm, label = 'Slide to confirm', disabled = false, style, color }: Props) {
const trackWidth = useRef(0);
const confirmed = useRef(false);
const translateX = useRef(new Animated.Value(0)).current;
@@ -85,7 +86,7 @@ export function SlideToConfirm({ onConfirm, label = 'Slide to confirm', disabled
return (
<View
style={[styles.track, disabled && styles.trackDisabled, style]}
style={[styles.track, disabled && styles.trackDisabled, color && !disabled ? { backgroundColor: color } : undefined, style]}
onLayout={e => { trackWidth.current = e.nativeEvent.layout.width; }}
>
<Animated.View style={[StyleSheet.absoluteFill, styles.labelWrap, { opacity: labelOpacity }]} pointerEvents="none">