Fix progress bar not showing on some pages - 2.2 🚀

Moving the bar  from App.tsx -> AppDrawer.tsx was a mistake,
because then the bar only shows on drawer routes instead of
app-wide.
This commit is contained in:
Brandon Presley 2023-11-15 14:30:05 +13:00
parent 608bb3e97a
commit b44cbae131
5 changed files with 71 additions and 76 deletions

View File

@ -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 = () => {
</NavigationContainer>
<AppSnack textColor={paperTheme.colors.background} />
<TimerProgress />
</PaperProvider>
);
};

View File

@ -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<DrawerParams>();
@ -24,7 +23,6 @@ export default function AppDrawer({
const { dark } = useTheme();
return (
<>
<Drawer.Navigator
screenOptions={{
headerTintColor: dark ? "white" : "black",
@ -80,7 +78,5 @@ export default function AppDrawer({
options={{ drawerIcon: () => <IconButton icon="cog-outline" /> }}
/>
</Drawer.Navigator>
<TimerProgress />
</>
);
}

View File

@ -1,14 +1,12 @@
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(() => {
useEffect(() => {
const description = emitter.addListener(
"tick",
({ minutes, seconds }: TickEvent) => {
@ -17,8 +15,7 @@ export default function TimerProgress() {
}
);
return description.remove;
}, [])
);
}, []);
if (progress === 0) return null;

View File

@ -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 {

View File

@ -1,6 +1,6 @@
{
"name": "massive",
"version": "2.1",
"version": "2.2",
"private": true,
"license": "GPL-3.0-only",
"scripts": {