diff --git a/src/screens/DashboardScreen.tsx b/src/screens/DashboardScreen.tsx index 995b674..78db588 100644 --- a/src/screens/DashboardScreen.tsx +++ b/src/screens/DashboardScreen.tsx @@ -13,15 +13,18 @@ export default function DashboardScreen({ navigation }: Props) { const insets = useSafeAreaInsets() const [latest, setLatest] = useState(null) const [all, setAll] = useState([]) + const [loading, setLoading] = useState(true) useFocusEffect( useCallback(() => { const load = async () => { + setLoading(true) await initDatabase() const allM = await getAllMeasurements() const visible = allM.filter(m => !m.deletedAt) setAll(visible) setLatest(visible.length > 0 ? visible[0] : null) + setLoading(false) } load() }, []) @@ -38,8 +41,14 @@ export default function DashboardScreen({ navigation }: Props) { - - + {loading ? ( + Laden... + ) : ( + <> + + + + )}