From 8ee07823aa3268d6418a9e7a58166f7b00d5879f Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Tue, 14 Nov 2023 14:47:08 +1300 Subject: [PATCH] =?UTF-8?q?Replace=20useDark=20with=20useTheme=20-=201.185?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppDrawer.tsx | 7 +++---- AppInput.tsx | 5 ++--- ExerciseItem.tsx | 7 +++---- PlanItem.tsx | 5 ++--- SetItem.tsx | 5 ++--- android/app/build.gradle | 4 ++-- package.json | 2 +- use-dark.ts | 11 ----------- 8 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 use-dark.ts diff --git a/AppDrawer.tsx b/AppDrawer.tsx index 54e594c..681f675 100644 --- a/AppDrawer.tsx +++ b/AppDrawer.tsx @@ -1,6 +1,6 @@ import { createDrawerNavigator } from "@react-navigation/drawer"; import { StackScreenProps } from "@react-navigation/stack"; -import { IconButton } from "react-native-paper"; +import { IconButton, useTheme } from "react-native-paper"; import ExerciseList from "./ExerciseList"; import GraphsList from "./GraphsList"; import InsightsPage from "./InsightsPage"; @@ -8,10 +8,9 @@ import PlanList from "./PlanList"; import SetList from "./SetList"; import SettingsPage from "./SettingsPage"; import TimerPage from "./TimerPage"; +import TimerProgress from "./TimerProgress"; import WeightList from "./WeightList"; import { DrawerParams } from "./drawer-param-list"; -import useDark from "./use-dark"; -import TimerProgress from "./TimerProgress"; const Drawer = createDrawerNavigator(); @@ -22,7 +21,7 @@ interface AppDrawerParams { export default function AppDrawer({ route, }: StackScreenProps<{ startup: AppDrawerParams }>) { - const dark = useDark(); + const { dark } = useTheme(); return ( <> diff --git a/AppInput.tsx b/AppInput.tsx index 99a60f9..3a5acef 100644 --- a/AppInput.tsx +++ b/AppInput.tsx @@ -1,15 +1,14 @@ import React, { ComponentProps, Ref } from "react"; -import { TextInput } from "react-native-paper"; +import { TextInput, useTheme } from "react-native-paper"; import { CombinedDefaultTheme } from "./App"; import { MARGIN } from "./constants"; -import useDark from "./use-dark"; function AppInput( props: Partial> & { innerRef?: Ref; } ) { - const dark = useDark(); + const { dark } = useTheme(); return ( >(); - const dark = useDark(); + const { dark } = useTheme(); const description = useMemo(() => { const seconds = item.seconds?.toString().padStart(2, "0"); diff --git a/PlanItem.tsx b/PlanItem.tsx index a34ca82..3e3d0b3 100644 --- a/PlanItem.tsx +++ b/PlanItem.tsx @@ -5,14 +5,13 @@ import { } from "@react-navigation/native"; import { useCallback, useMemo, useState } from "react"; import { Text } from "react-native"; -import { List } from "react-native-paper"; +import { List, useTheme } from "react-native-paper"; import { StackParams } from "./AppStack"; import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants"; import { DAYS } from "./days"; import { setRepo } from "./db"; import GymSet, { defaultSet } from "./gym-set"; import { Plan } from "./plan"; -import useDark from "./use-dark"; export default function PlanItem({ item, @@ -24,7 +23,7 @@ export default function PlanItem({ setIds: (value: number[]) => void; }) { const [today, setToday] = useState(); - const dark = useDark(); + const { dark } = useTheme(); const days = useMemo(() => item.days.split(","), [item.days]); const navigation = useNavigation>(); diff --git a/SetItem.tsx b/SetItem.tsx index 15965c2..59a92b9 100644 --- a/SetItem.tsx +++ b/SetItem.tsx @@ -2,12 +2,11 @@ import { NavigationProp, useNavigation } from "@react-navigation/native"; import { format } from "date-fns"; import { useCallback, useMemo } from "react"; import { Image } from "react-native"; -import { List, Text } from "react-native-paper"; +import { List, Text, useTheme } from "react-native-paper"; import { StackParams } from "./AppStack"; import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants"; import GymSet from "./gym-set"; import Settings from "./settings"; -import useDark from "./use-dark"; export default function SetItem({ item, @@ -24,7 +23,7 @@ export default function SetItem({ disablePress?: boolean; customBg?: string; }) { - const dark = useDark(); + const { dark } = useTheme(); const navigation = useNavigation>(); const longPress = useCallback(() => { diff --git a/android/app/build.gradle b/android/app/build.gradle index 6bcf6bb..52fe808 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,8 +85,8 @@ android { applicationId "com.massive" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36210 - versionName "1.184" + versionCode 36211 + versionName "1.185" } signingConfigs { release { diff --git a/package.json b/package.json index b80fa15..cd651f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "1.184", + "version": "1.185", "private": true, "license": "GPL-3.0-only", "scripts": { diff --git a/use-dark.ts b/use-dark.ts deleted file mode 100644 index db25e68..0000000 --- a/use-dark.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { useColorScheme } from "react-native"; -import { useAppTheme } from "./use-theme"; - -export default function useDark() { - const dark = useColorScheme() === "dark"; - const { theme } = useAppTheme(); - - if (theme === "dark") return true; - if (theme === "light") return false; - return dark; -}