diff --git a/app/content/drill/index.js b/app/content/drill/index.js index ee694946..061395ed 100644 --- a/app/content/drill/index.js +++ b/app/content/drill/index.js @@ -1,8 +1,10 @@ import { Link, useNavigation } from "expo-router"; -import { ScrollView, StyleSheet } from "react-native"; +import { useCallback, useState } from "react"; +import { RefreshControl, ScrollView, StyleSheet } from "react-native"; import { Appbar, List, PaperProvider } from "react-native-paper"; import { SafeAreaView } from "react-native-safe-area-context"; +import { router } from "expo-router"; import ErrorComponent from "~/components/errorComponent"; import Loading from "~/components/loading"; import { useDrillInfo } from "~/hooks/useDrillInfo"; @@ -16,6 +18,16 @@ export default function Index() { isLoading: drillInfoIsLoading, } = useDrillInfo(); + const [refreshing, setRefreshing] = useState(false); + + const onRefresh = useCallback(() => { + setRefreshing(true); + setTimeout(() => { + router.replace("content/drill/"); + setRefreshing(false); + }, 500); + }, []); + if (drillInfoIsLoading) { return ; } @@ -31,7 +43,12 @@ export default function Index() { - + + } + > {Object.values(drillInfo).map((drill) => ( { + setRefreshing(true); + setTimeout(() => { + router.replace("content/profile/"); + setRefreshing(false); + }, 500); + }, []); + if (userIsLoading || drillInfoIsLoading || attemptsIsLoading) { return ; } @@ -90,7 +108,12 @@ function Index(props) { /> - + + } + > diff --git a/app/content/team/index.js b/app/content/team/index.js index 283365a1..59b03b9f 100644 --- a/app/content/team/index.js +++ b/app/content/team/index.js @@ -3,11 +3,12 @@ import { BottomSheetModalProvider, } from "@gorhom/bottom-sheet"; import { router } from "expo-router"; -import React, { useCallback, useMemo, useRef } from "react"; +import React, { useCallback, useMemo, useRef, useState } from "react"; import { Image, Keyboard, Pressable, + RefreshControl, TouchableWithoutFeedback, View, } from "react-native"; @@ -51,6 +52,16 @@ function Index() { //console.log("handleSheetChanges", index); }, []); + const [refreshing, setRefreshing] = useState(false); + + const onRefresh = useCallback(() => { + setRefreshing(true); + setTimeout(() => { + router.replace("content/team/"); + setRefreshing(false); + }, 500); + }, []); + if (userIsLoading) return ; if (userError) return ; @@ -93,6 +104,12 @@ function Index() { keyboardShouldPersistTaps="handled" showsVerticalScrollIndicator={false} stickyHeaderIndices={[3]} + refreshControl={ + + } >