feat(mobile): MIKRO POLISH-1 haptik + tryck-skala i Button/Card

This commit is contained in:
Sven (AAMOS AI)
2026-08-17 21:01:09 +07:00
parent 260f816c83
commit b1a93be974
+13 -5
View File
@@ -17,6 +17,15 @@ import {
import { SafeAreaView } from "react-native-safe-area-context"; import { SafeAreaView } from "react-native-safe-area-context";
import { colors, radius, spacing, typography } from "@/lib/theme"; import { colors, radius, spacing, typography } from "@/lib/theme";
import { t } from "@/lib/i18n"; import { t } from "@/lib/i18n";
import * as Haptics from "expo-haptics";
/** Lätt haptik + handlern — gör tryck taktila i hela appen. */
function withHaptic(fn: () => void): () => void {
return () => {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => {});
fn();
};
}
export function Screen({ export function Screen({
children, children,
@@ -85,9 +94,8 @@ export function Card({
if (onPress) { if (onPress) {
return ( return (
<Pressable <Pressable
onPress={onPress} onPress={withHaptic(onPress)}
style={({ pressed }) => [styles.card, style, pressed && { opacity: 0.9, transform: [{ scale: 0.97 }] }]} style={({ pressed }) => [styles.card, style, pressed && { opacity: 0.85, transform: [{ scale: 0.98 }] }]}>
>
{children} {children}
</Pressable> </Pressable>
); );
@@ -120,11 +128,11 @@ export function Button({
variant === "primary" ? "#fff" : variant === "danger" ? colors.danger : colors.primaryDark; variant === "primary" ? "#fff" : variant === "danger" ? colors.danger : colors.primaryDark;
return ( return (
<Pressable <Pressable
onPress={onPress} onPress={withHaptic(onPress)}
disabled={disabled || loading} disabled={disabled || loading}
style={({ pressed }) => [ style={({ pressed }) => [
styles.button, styles.button,
{ backgroundColor: bg, opacity: disabled ? 0.5 : pressed ? 0.85 : 1 }, { backgroundColor: bg, opacity: disabled ? 0.5 : pressed ? 0.85 : 1, transform: [{ scale: pressed ? 0.97 : 1 }] },
variant === "ghost" && { borderWidth: 1, borderColor: colors.border }, variant === "ghost" && { borderWidth: 1, borderColor: colors.border },
]} ]}
> >