From b44cbae131716f9041998b36fcfe60ced803cdbc Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 15 Nov 2023 14:30:05 +1300 Subject: [PATCH] =?UTF-8?q?Fix=20progress=20bar=20not=20showing=20on=20som?= =?UTF-8?q?e=20pages=20-=202.2=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving the bar from App.tsx -> AppDrawer.tsx was a mistake, because then the bar only shows on drawer routes instead of app-wide. --- App.tsx | 2 + AppDrawer.tsx | 112 +++++++++++++++++++-------------------- TimerProgress.tsx | 27 +++++----- android/app/build.gradle | 4 +- package.json | 2 +- 5 files changed, 71 insertions(+), 76 deletions(-) diff --git a/App.tsx b/App.tsx index 07fb73c..a0065cb 100644 --- a/App.tsx +++ b/App.tsx @@ -17,6 +17,7 @@ import FatalError from "./FatalError"; import { AppDataSource } from "./data-source"; import { settingsRepo } from "./db"; import { ThemeContext } from "./use-theme"; +import TimerProgress from "./TimerProgress"; export const CombinedDefaultTheme = { ...NavigationDefaultTheme, @@ -117,6 +118,7 @@ const App = () => { + ); }; diff --git a/AppDrawer.tsx b/AppDrawer.tsx index e6c3e91..83ddf48 100644 --- a/AppDrawer.tsx +++ b/AppDrawer.tsx @@ -9,7 +9,6 @@ import PlanList from "./PlanList"; import SetList from "./SetList"; import SettingsPage from "./SettingsPage"; import TimerPage from "./TimerPage"; -import TimerProgress from "./TimerProgress"; import WeightList from "./WeightList"; const Drawer = createDrawerNavigator(); @@ -24,63 +23,60 @@ export default function AppDrawer({ const { dark } = useTheme(); return ( - <> - + }} + /> + }} + /> + }} + /> + , }} - initialRouteName={ - (route.params.startup as keyof DrawerParams) || "History" - } - > - }} - /> - }} - /> - }} - /> - , - }} - /> - }} - /> - }} - /> - , - }} - /> - }} - /> - - - + /> + }} + /> + }} + /> + , + }} + /> + }} + /> + ); } diff --git a/TimerProgress.tsx b/TimerProgress.tsx index 2b52b10..db53f9b 100644 --- a/TimerProgress.tsx +++ b/TimerProgress.tsx @@ -1,24 +1,21 @@ -import { useFocusEffect } from "@react-navigation/native"; -import { useCallback, useState } from "react"; +import { useEffect, useState } from "react"; import { ProgressBar } from "react-native-paper"; -import { emitter } from "./emitter"; import { TickEvent } from "./TimerPage"; +import { emitter } from "./emitter"; export default function TimerProgress() { const [progress, setProgress] = useState(0); - useFocusEffect( - useCallback(() => { - const description = emitter.addListener( - "tick", - ({ minutes, seconds }: TickEvent) => { - setProgress((Number(minutes) * 60 + Number(seconds)) / 210); - console.log({ minutes, seconds }); - } - ); - return description.remove; - }, []) - ); + useEffect(() => { + const description = emitter.addListener( + "tick", + ({ minutes, seconds }: TickEvent) => { + setProgress((Number(minutes) * 60 + Number(seconds)) / 210); + console.log({ minutes, seconds }); + } + ); + return description.remove; + }, []); if (progress === 0) return null; diff --git a/android/app/build.gradle b/android/app/build.gradle index 8ff021c..dbfe153 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 36216 - versionName "2.1" + versionCode 36217 + versionName "2.2" } signingConfigs { release { diff --git a/package.json b/package.json index b3793bd..42164a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "2.1", + "version": "2.2", "private": true, "license": "GPL-3.0-only", "scripts": {