From b6d6c02d0a6f280191e151ecda6fec0c8930917d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C3=ABl=20Perret?= Date: Thu, 10 Sep 2026 11:55:46 +0200 Subject: [PATCH] feat : Slider et RangeSlider --- src/app/_layout.tsx | 40 +- src/app/switch-demo.tsx | 134 ++++++- src/components/ui/RangeSlider.tsx | 619 ++++++++++++++++++++++++++++++ src/components/ui/Slider.tsx | 415 ++++++++++++++++++++ src/components/ui/index.ts | 8 + src/components/ui/sliderParts.tsx | 80 ++++ src/theme/spacing.ts | 26 ++ 7 files changed, 1300 insertions(+), 22 deletions(-) create mode 100644 src/components/ui/RangeSlider.tsx create mode 100644 src/components/ui/Slider.tsx create mode 100644 src/components/ui/index.ts create mode 100644 src/components/ui/sliderParts.tsx diff --git a/src/app/_layout.tsx b/src/app/_layout.tsx index 9b2ed88..7c70c95 100644 --- a/src/app/_layout.tsx +++ b/src/app/_layout.tsx @@ -4,6 +4,7 @@ import * as SplashScreen from 'expo-splash-screen'; import * as SystemUI from 'expo-system-ui'; import { useEffect } from 'react'; import { StatusBar } from 'react-native'; +import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { SafeAreaProvider } from 'react-native-safe-area-context'; import { queryClient } from '../hooks/queryClient'; @@ -36,24 +37,25 @@ export default function RootLayout() { if (!ready) return null; return ( - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + ); } diff --git a/src/app/switch-demo.tsx b/src/app/switch-demo.tsx index 0df5628..23c8d2e 100644 --- a/src/app/switch-demo.tsx +++ b/src/app/switch-demo.tsx @@ -1,8 +1,9 @@ import { useState } from 'react'; import { StyleSheet, Text, View } from 'react-native'; +import { Button } from '@/components/Button'; import { FormField, Switch } from '@/components/form'; -import { Screen } from '@/components/ui/Screen'; +import { RangeSlider, Screen, Slider } from '@/components/ui'; import { colors } from '@/theme/colors'; import { spacing } from '@/theme/spacing'; import { typography } from '@/theme/typography'; @@ -10,12 +11,24 @@ import { typography } from '@/theme/typography'; export default function SwitchDemoScreen() { const [pushEnabled, setPushEnabled] = useState(true); const [weeklyDigestEnabled, setWeeklyDigestEnabled] = useState(false); + const [locationEnabled, setLocationEnabled] = useState(true); + const [autoPlayEnabled, setAutoPlayEnabled] = useState(false); + const [radiusKm, setRadiusKm] = useState(25); + const [resultCount, setResultCount] = useState(128); + const [priceRange, setPriceRange] = useState<[number, number]>([0, 65]); + + const formatKm = (v: number) => `${v} km`; + const formatChf = (v: number) => `${v} CHF`; + const formatPriceRange = (minValue: number, maxValue: number) => { + const left = minValue === 0 ? 'Gratuit' : `${minValue} CHF`; + return `${left} - ${maxValue} CHF`; + }; return ( - DESIGN SYSTEM · SWITCH - Demos du composant Switch + DESIGN SYSTEM · SWITCH & SLIDER + Demos phase 4 + + + + + Localisation precise + + + + + Lecture auto des extraits + + + + +