diff --git a/src/navigation/TabNavigator.tsx b/src/navigation/TabNavigator.tsx index f80141d..f7decff 100644 --- a/src/navigation/TabNavigator.tsx +++ b/src/navigation/TabNavigator.tsx @@ -78,9 +78,12 @@ const ServicesStack = createStackNavigator(); function ServicesStackComponent() { return ( - + @@ -102,9 +105,12 @@ const ProxiwashStack = createStackNavigator(); function ProxiwashStackComponent() { return ( - + @@ -121,9 +127,9 @@ const PlanningStack = createStackNavigator(); function PlanningStackComponent() { return ( - + @@ -148,9 +154,9 @@ function HomeStackComponent( } const { colors } = useTheme(); return ( - + + >(); - const [mascotDialogVisible, setMascotDialogVisible] = useState(false); + const [mascotDialogVisible, setMascotDialogVisible] = useState< + undefined | boolean + >(undefined); const requestAll = useAuthenticatedRequest<{ devices: Array }>( 'location/all' diff --git a/src/screens/Amicale/LoginScreen.tsx b/src/screens/Amicale/LoginScreen.tsx index 56eca27..6393df1 100644 --- a/src/screens/Amicale/LoginScreen.tsx +++ b/src/screens/Amicale/LoginScreen.tsx @@ -44,7 +44,9 @@ function LoginScreen(props: Props) { const { setLogin } = useLogin(); const [loading, setLoading] = useState(false); const [nextScreen, setNextScreen] = useState(undefined); - const [mascotDialogVisible, setMascotDialogVisible] = useState(false); + const [mascotDialogVisible, setMascotDialogVisible] = useState< + undefined | boolean + >(undefined); const [currentError, setCurrentError] = useState({ status: REQUEST_STATUS.SUCCESS, }); @@ -79,9 +81,9 @@ function LoginScreen(props: Props) { .finally(() => setLoading(false)); }; - const hideMascotDialog = () => setMascotDialogVisible(true); + const hideMascotDialog = () => setMascotDialogVisible(false); - const showMascotDialog = () => setMascotDialogVisible(false); + const showMascotDialog = () => setMascotDialogVisible(true); const hideErrorDialog = () => setCurrentError({ status: REQUEST_STATUS.SUCCESS }); diff --git a/src/screens/Amicale/VoteScreen.tsx b/src/screens/Amicale/VoteScreen.tsx index 49a0686..e7245d4 100644 --- a/src/screens/Amicale/VoteScreen.tsx +++ b/src/screens/Amicale/VoteScreen.tsx @@ -133,7 +133,9 @@ const styles = StyleSheet.create({ */ export default function VoteScreen() { const [hasVoted, setHasVoted] = useState(false); - const [mascotDialogVisible, setMascotDialogVisible] = useState(false); + const [mascotDialogVisible, setMascotDialogVisible] = useState< + undefined | boolean + >(undefined); const datesRequest = useAuthenticatedRequest( 'elections/dates' diff --git a/src/utils/asyncStorage.ts b/src/utils/asyncStorage.ts index 6cea841..17c6a9a 100644 --- a/src/utils/asyncStorage.ts +++ b/src/utils/asyncStorage.ts @@ -110,13 +110,17 @@ export const defaultPreferences: { [key in GeneralPreferenceKeys]: string } = { export function isValidGeneralPreferenceKey( key: string ): key is GeneralPreferenceKeys { - return key in Object.values(GeneralPreferenceKeys); + return Object.values(GeneralPreferenceKeys).includes( + key as GeneralPreferenceKeys + ); } export function isValidMascotPreferenceKey( key: string ): key is MascotPreferenceKeys { - return key in Object.values(MascotPreferenceKeys); + return Object.values(MascotPreferenceKeys).includes( + key as MascotPreferenceKeys + ); } /**