diff --git a/apps/expo/src/app/(tabs)/_layout.tsx b/apps/expo/src/app/(tabs)/_layout.tsx index a3e1e7c..5aed39b 100644 --- a/apps/expo/src/app/(tabs)/_layout.tsx +++ b/apps/expo/src/app/(tabs)/_layout.tsx @@ -1,4 +1,3 @@ -import { useRef } from "react"; import { Platform } from "react-native"; import * as Haptics from "expo-haptics"; import { Tabs } from "expo-router"; @@ -8,119 +7,108 @@ import { useTheme, View } from "tamagui"; import { MovieWebSvg } from "~/components/Icon"; import SvgTabBarIcon from "~/components/SvgTabBarIcon"; import TabBarIcon from "~/components/TabBarIcon"; -import SearchTabContext from "../../components/ui/SearchTabContext"; export default function TabLayout() { - // eslint-disable-next-line @typescript-eslint/no-empty-function - const focusSearchInputRef = useRef(() => {}); - const theme = useTheme(); return ( - - ({ + tabPress: () => { + void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); + }, + focus: () => { + void ScreenOrientation.lockAsync( + ScreenOrientation.OrientationLock.PORTRAIT_UP, + ); + }, + })} + screenOptions={{ + headerShown: false, + tabBarActiveTintColor: theme.tabBarIconFocused.val, + tabBarStyle: { + backgroundColor: theme.tabBarBackground.val, + borderTopColor: "transparent", + borderTopRightRadius: 20, + borderTopLeftRadius: 20, + paddingBottom: Platform.select({ ios: 100 }), + height: 80, + }, + tabBarItemStyle: { + paddingVertical: 18, + height: 82, + }, + tabBarLabelStyle: [ + { + marginTop: 2, + }, + ], + }} + > + ( + + ), }} - screenListeners={({ route }) => ({ - tabPress: () => { - void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); - switch (route.name) { - case "search": - focusSearchInputRef.current(); - break; - } - }, - focus: () => { - void ScreenOrientation.lockAsync( - ScreenOrientation.OrientationLock.PORTRAIT_UP, - ); - }, - })} - screenOptions={{ - headerShown: false, - tabBarActiveTintColor: theme.tabBarIconFocused.val, - tabBarStyle: { - backgroundColor: theme.tabBarBackground.val, - borderTopColor: "transparent", - borderTopRightRadius: 20, - borderTopLeftRadius: 20, - paddingBottom: Platform.select({ ios: 100 }), - height: 80, - }, - tabBarItemStyle: { - paddingVertical: 18, - height: 82, - }, - tabBarLabelStyle: [ - { - marginTop: 2, - }, - ], + /> + ( + + ), }} - > - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - - - ), - }} - /> - ( - - - - ), - }} - /> - ( - - ), - }} - /> - - + /> + ( + + + + ), + }} + /> + ( + + + + ), + }} + /> + ( + + ), + }} + /> + ); } diff --git a/apps/expo/src/app/(tabs)/settings.tsx b/apps/expo/src/app/(tabs)/settings.tsx index 6c0ca15..8670d79 100644 --- a/apps/expo/src/app/(tabs)/settings.tsx +++ b/apps/expo/src/app/(tabs)/settings.tsx @@ -11,7 +11,6 @@ import { Select, Separator, Sheet, - Switch, Text, useTheme, View, @@ -21,6 +20,7 @@ import { import type { ThemeStoreOption } from "~/stores/theme"; import ScreenLayout from "~/components/layout/ScreenLayout"; +import { MWSwitch } from "~/components/ui/Switch"; import { checkForUpdate } from "~/lib/update"; import { getGestureControls, saveGestureControls } from "~/settings"; import { useThemeStore } from "~/stores/theme"; @@ -76,14 +76,12 @@ export default function SettingsScreen() { - - - + + diff --git a/apps/expo/src/components/ui/Button.tsx b/apps/expo/src/components/ui/Button.tsx index 35b970e..a10ed40 100644 --- a/apps/expo/src/components/ui/Button.tsx +++ b/apps/expo/src/components/ui/Button.tsx @@ -1,51 +1,28 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import type { ButtonProps } from "tamagui"; -import React from "react"; import { Button, styled } from "tamagui"; -const PrimaryButton = styled(Button, { - backgroundColor: "$buttonPrimaryBackground", - color: "$buttonPrimaryText", - fontWeight: "bold", +export const MWButton = styled(Button, { + variants: { + type: { + primary: { + backgroundColor: "$buttonPrimaryBackground", + color: "$buttonPrimaryText", + fontWeight: "bold", + }, + secondary: { + backgroundColor: "$buttonSecondaryBackground", + color: "$buttonSecondaryText", + fontWeight: "bold", + }, + purple: { + backgroundColor: "$buttonPurpleBackground", + color: "white", + fontWeight: "bold", + }, + cancel: { + backgroundColor: "$buttonCancelBackground", + color: "white", + fontWeight: "bold", + }, + }, + } as const, }); - -const SecondaryButton = styled(Button, { - backgroundColor: "$buttonSecondaryBackground", - color: "$buttonSecondaryText", - fontWeight: "bold", -}); - -const PurpleButton = styled(Button, { - backgroundColor: "$buttonPurpleBackground", - color: "white", - fontWeight: "bold", -}); - -const CancelButton = styled(Button, { - backgroundColor: "$buttonCancelBackground", - color: "white", - fontWeight: "bold", -}); - -export const MWButton = React.forwardRef< - typeof Button, - ButtonProps & { - type?: "primary" | "secondary" | "purple" | "cancel"; - } ->((props, ref) => { - const { type, ...rest } = props; - switch (type) { - case "primary": - return ; - case "secondary": - return ; - case "purple": - return ; - case "cancel": - return ; - default: - return