From d4246aa2c89aca6f8218b034fc334e1134069979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C3=ABl=20Perret?= Date: Tue, 1 Sep 2026 16:45:11 +0200 Subject: [PATCH] fix : Pas besoin de theming --- app.json | 10 ++++----- src/app/_layout.tsx | 5 +---- src/app/index.tsx | 5 +++-- src/components/Badge.tsx | 5 +++-- src/components/Button.tsx | 6 ++++-- src/components/ParticipationSegment.tsx | 5 +++-- src/components/ThemeChip.tsx | 7 ++++--- src/theme/ThemeProvider.tsx | 24 --------------------- src/theme/useTheme.ts | 28 ------------------------- 9 files changed, 23 insertions(+), 72 deletions(-) delete mode 100644 src/theme/ThemeProvider.tsx delete mode 100644 src/theme/useTheme.ts diff --git a/app.json b/app.json index ad276b2..e6895e9 100644 --- a/app.json +++ b/app.json @@ -1,12 +1,12 @@ { "expo": { - "name": "bahla_front", - "slug": "bahla_front", + "name": "bahla", + "slug": "bahla", "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", - "scheme": "bahlafront", - "userInterfaceStyle": "automatic", + "scheme": "bahla", + "userInterfaceStyle": "dark", "ios": { "icon": "./assets/expo.icon" }, @@ -18,7 +18,7 @@ "monochromeImage": "./assets/images/android-icon-monochrome.png" }, "predictiveBackGestureEnabled": false, - "package": "com.anonymous.bahla_front" + "package": "com.anonymous.bahla" }, "web": { "bundler": "metro", diff --git a/src/app/_layout.tsx b/src/app/_layout.tsx index 39a086f..ef58010 100644 --- a/src/app/_layout.tsx +++ b/src/app/_layout.tsx @@ -1,6 +1,5 @@ import { Stack } from 'expo-router'; -import { ThemeProvider } from '../theme'; import { useAppFonts } from '../theme/typography'; export default function RootLayout() { @@ -11,8 +10,6 @@ export default function RootLayout() { } return ( - - - + ); } diff --git a/src/app/index.tsx b/src/app/index.tsx index 4bfa9a4..abe6a73 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -6,12 +6,13 @@ import { Badge } from '@/components/Badge'; import { Button } from '@/components/Button'; import { ParticipationSegment } from '@/components/ParticipationSegment'; import { ThemeChip } from '@/components/ThemeChip'; -import { useTheme } from '@/theme/useTheme'; +import { colors } from '@/theme/colors'; +import { spacing } from '@/theme/spacing'; +import { typography } from '@/theme/typography'; import '../global.css'; export default function Index() { - const { colors, spacing, typography } = useTheme(); const [selectedThemes, setSelectedThemes] = useState(['Soirée', 'Techno', 'Festival']); const themeOptions = useMemo( diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx index 3d08767..c377bdf 100644 --- a/src/components/Badge.tsx +++ b/src/components/Badge.tsx @@ -10,7 +10,9 @@ import { type ViewStyle, } from 'react-native'; -import { useTheme } from '@/theme/useTheme'; +import { colors } from '@/theme/colors'; +import { borderRadius } from '@/theme/spacing'; +import { typography } from '@/theme/typography'; export type BadgeVariant = 'verified' | 'tonight' | 'free' | 'complete' | 'draft' | 'pro' | 'date'; @@ -48,7 +50,6 @@ export function Badge({ style, textStyle, }: BadgeProps) { - const { colors, typography, borderRadius } = useTheme(); const pulse = useRef(new Animated.Value(1)).current; useEffect(() => { diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 6ccbaf3..b3bbaad 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -14,7 +14,10 @@ import { } from 'react-native'; import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'; -import { useTheme } from '@/theme/useTheme'; +import { colors, gradientDirection, gradients } from '@/theme/colors'; +import { borderRadius } from '@/theme/spacing'; +import { typography } from '@/theme/typography'; + const BUTTON_HEIGHT = 52; const PRESSED_SCALE = 0.97; @@ -67,7 +70,6 @@ export function Button({ accessibilityLabel, testID, }: ButtonProps) { - const { colors, borderRadius, typography, gradients, gradientDirection } = useTheme(); const [internalLoading, setInternalLoading] = useState(false); const [isPressed, setIsPressed] = useState(false); diff --git a/src/components/ParticipationSegment.tsx b/src/components/ParticipationSegment.tsx index f866702..d822a78 100644 --- a/src/components/ParticipationSegment.tsx +++ b/src/components/ParticipationSegment.tsx @@ -19,7 +19,9 @@ import Animated, { withTiming, } from 'react-native-reanimated'; -import { useTheme } from '@/theme/useTheme'; +import { colors, glow, gradientDirection, gradients } from '@/theme/colors'; +import { borderRadius } from '@/theme/spacing'; +import { typography } from '@/theme/typography'; type ParticipationValue = { going: boolean; @@ -58,7 +60,6 @@ export function ParticipationSegment({ style, testID, }: ParticipationSegmentProps) { - const { colors, gradients, gradientDirection, typography, borderRadius, glow } = useTheme(); const [internalValue, setInternalValue] = useState({ going: defaultValue?.going ?? false, diff --git a/src/components/ThemeChip.tsx b/src/components/ThemeChip.tsx index 6b86bd8..9b14cdc 100644 --- a/src/components/ThemeChip.tsx +++ b/src/components/ThemeChip.tsx @@ -11,7 +11,10 @@ import { type ViewStyle, } from 'react-native'; -import { useTheme } from '@/theme/useTheme'; +import { colors, gradientDirection, gradients } from '@/theme/colors'; +import { borderRadius } from '@/theme/spacing'; +import { typography } from '@/theme/typography'; + export type ThemeChipSelectedVariant = 'gradient' | 'accent'; @@ -46,8 +49,6 @@ export function ThemeChip({ testID, accessibilityLabel, }: ThemeChipProps) { - const { colors, gradients, gradientDirection, borderRadius, typography } = useTheme(); - const resolvedValue = value ?? label; const isGradient = selected && selectedVariant === 'gradient'; const showSelectedIcon = selected && (showCross ?? showRemoveIcon); diff --git a/src/theme/ThemeProvider.tsx b/src/theme/ThemeProvider.tsx deleted file mode 100644 index e0d863e..0000000 --- a/src/theme/ThemeProvider.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { type PropsWithChildren, useMemo } from 'react'; - -import { colors, glow, gradientDirection, gradients, palette } from './colors'; -import spacing, { borderRadius } from './spacing'; -import typography from './typography'; -import { ThemeContext } from './useTheme'; - -export function ThemeProvider({ children }: PropsWithChildren) { - const value = useMemo( - () => ({ - colors, - gradients, - glow, - gradientDirection, - palette, - typography, - spacing, - borderRadius, - }), - [], - ); - - return {children}; -} diff --git a/src/theme/useTheme.ts b/src/theme/useTheme.ts deleted file mode 100644 index 8c5ffad..0000000 --- a/src/theme/useTheme.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { createContext, useContext } from 'react'; - -import { colors, glow, gradientDirection, gradients, palette } from './colors'; -import spacing, { borderRadius } from './spacing'; -import typography from './typography'; - -export type ThemeContextValue = { - colors: typeof colors; - gradients: typeof gradients; - glow: typeof glow; - gradientDirection: typeof gradientDirection; - palette: typeof palette; - typography: typeof typography; - spacing: typeof spacing; - borderRadius: typeof borderRadius; -}; - -export const ThemeContext = createContext(undefined); - -export const useTheme = () => { - const context = useContext(ThemeContext); - - if (!context) { - throw new Error('useTheme must be used within a ThemeProvider'); - } - - return context; -};