From fe36b38487206b12d5d0fcc32f44432ca3591608 Mon Sep 17 00:00:00 2001 From: StarAppeal Date: Fri, 5 Sep 2025 00:32:20 +0200 Subject: [PATCH] use non-null assertions and optional chaining for authenticatedUser state handling --- app/(tabs)/index.tsx | 2 +- app/(tabs)/modes/text.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index 521ffe5..80e9d1a 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -13,7 +13,7 @@ export default function HomeScreen() { const {theme} = useTheme(); useEffect(() => { - setIdle(authenticatedUser?.lastState.global.mode === "idle") + setIdle(authenticatedUser!.lastState?.global.mode === "idle") }, []) return ( diff --git a/app/(tabs)/modes/text.tsx b/app/(tabs)/modes/text.tsx index 700d9a7..364fdcc 100644 --- a/app/(tabs)/modes/text.tsx +++ b/app/(tabs)/modes/text.tsx @@ -9,7 +9,7 @@ import {View} from "react-native"; export default function TextScreen() { const {authenticatedUser} = useAuth(); - const [textProps, setTextProps] = useState(authenticatedUser?.lastState.text); + const [textProps, setTextProps] = useState(authenticatedUser!.lastState?.text); return ( @@ -29,7 +29,7 @@ export default function TextScreen() { setTextProps(prev => ({ ...prev!, color: rgb }))} - defaultColor={textProps!.color} + defaultColor={textProps?.color} />