Fix linting errors
This commit is contained in:
parent
f15c6df20b
commit
8311f5098c
32
EditSet.tsx
32
EditSet.tsx
|
@ -60,15 +60,15 @@ export default function EditSet() {
|
||||||
todaysWorkouts[todaysWorkouts.indexOf(todaysSets[0].name!) + 1];
|
todaysWorkouts[todaysWorkouts.indexOf(todaysSets[0].name!) + 1];
|
||||||
if (!nextWorkout) return;
|
if (!nextWorkout) return;
|
||||||
setName(nextWorkout);
|
setName(nextWorkout);
|
||||||
}, []);
|
}, [getTodaysSets, getTodaysPlan]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (params.set.id) return;
|
if (params.set.id) return;
|
||||||
predict();
|
predict();
|
||||||
}, [predict]);
|
}, [predict, params.set.id]);
|
||||||
|
|
||||||
const onConfirm = (created: Date) => {
|
const onConfirm = (date: Date) => {
|
||||||
setCreated(created);
|
setCreated(date);
|
||||||
setShowDate(false);
|
setShowDate(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,7 +79,16 @@ export default function EditSet() {
|
||||||
[name, reps, weight, created.toISOString(), unit, params.set.id],
|
[name, reps, weight, created.toISOString(), unit, params.set.id],
|
||||||
);
|
);
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
}, [params.set, name, reps, weight, created, unit, db]);
|
}, [params.set, name, reps, weight, created, unit, db, navigation]);
|
||||||
|
|
||||||
|
const notify = useCallback(async () => {
|
||||||
|
const enabled = await AsyncStorage.getItem('alarmEnabled');
|
||||||
|
if (enabled !== 'true') return;
|
||||||
|
const minutes = await AsyncStorage.getItem('minutes');
|
||||||
|
const seconds = await AsyncStorage.getItem('seconds');
|
||||||
|
const milliseconds = Number(minutes) * 60 * 1000 + Number(seconds) * 1000;
|
||||||
|
NativeModules.AlarmModule.timer(milliseconds);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const add = useCallback(async () => {
|
const add = useCallback(async () => {
|
||||||
if (name === undefined || reps === '' || weight === '') return;
|
if (name === undefined || reps === '' || weight === '') return;
|
||||||
|
@ -96,21 +105,12 @@ export default function EditSet() {
|
||||||
]);
|
]);
|
||||||
notify();
|
notify();
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
}, [name, reps, weight, created, unit, db]);
|
}, [name, reps, weight, created, unit, db, navigation, notify]);
|
||||||
|
|
||||||
const notify = useCallback(async () => {
|
|
||||||
const enabled = await AsyncStorage.getItem('alarmEnabled');
|
|
||||||
if (enabled !== 'true') return;
|
|
||||||
const minutes = await AsyncStorage.getItem('minutes');
|
|
||||||
const seconds = await AsyncStorage.getItem('seconds');
|
|
||||||
const milliseconds = Number(minutes) * 60 * 1000 + Number(seconds) * 1000;
|
|
||||||
NativeModules.AlarmModule.timer(milliseconds);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const save = useCallback(async () => {
|
const save = useCallback(async () => {
|
||||||
if (params.set.id) return update();
|
if (params.set.id) return update();
|
||||||
return add();
|
return add();
|
||||||
}, [update, add]);
|
}, [update, add, params.set.id]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{padding: 10}}>
|
<ScrollView style={{padding: 10}}>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {DrawerNavigationProp} from '@react-navigation/drawer';
|
import {DrawerNavigationProp} from '@react-navigation/drawer';
|
||||||
import {TypedNavigator, useNavigation} from '@react-navigation/native';
|
import {useNavigation} from '@react-navigation/native';
|
||||||
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {IconButton} from 'react-native-paper';
|
import {IconButton} from 'react-native-paper';
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default function SetItem({
|
||||||
set.created = new Date().toISOString();
|
set.created = new Date().toISOString();
|
||||||
set.id = 0;
|
set.id = 0;
|
||||||
navigation.navigate('EditSet', {set});
|
navigation.navigate('EditSet', {set});
|
||||||
}, [navigation]);
|
}, [navigation, item]);
|
||||||
|
|
||||||
const longPress = useCallback(
|
const longPress = useCallback(
|
||||||
(e: GestureResponderEvent) => {
|
(e: GestureResponderEvent) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user