File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
mobile/components/OEncounterList Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import * as Sentry from "@sentry/react-native";
1414import * as React from "react" ;
1515import { useCallback , useEffect , useState } from "react" ;
1616import {
17+ ActivityIndicator ,
1718 RefreshControl ,
1819 ScrollView ,
1920 StyleSheet ,
@@ -33,7 +34,7 @@ export const OEncounterList = (props: IOEncounterListProps) => {
3334 const navigation = useNavigation ( ) ;
3435 const { state : encounterState , dispatch } = useEncountersContext ( ) ;
3536 const { state : userState } = useUserContext ( ) ;
36- const [ refreshing , setRefreshing ] = useState ( false ) ;
37+ const [ refreshing , setRefreshing ] = useState ( true ) ;
3738
3839 const fetchEncounters = useCallback ( async ( ) => {
3940 try {
@@ -143,7 +144,13 @@ export const OEncounterList = (props: IOEncounterListProps) => {
143144 styles . emptyListContainer
144145 }
145146 >
146- { getEncounterList ( ) }
147+ { refreshing && encounterState . encounters . length === 0 ? (
148+ < View style = { styles . loadingContainer } >
149+ < ActivityIndicator size = "large" color = { Color . gray } />
150+ </ View >
151+ ) : (
152+ getEncounterList ( )
153+ ) }
147154 </ ScrollView >
148155 ) ;
149156} ;
@@ -180,4 +187,9 @@ const styles = StyleSheet.create({
180187 height : "100%" ,
181188 minHeight : 400 ,
182189 } ,
190+ loadingContainer : {
191+ flex : 1 ,
192+ justifyContent : "center" ,
193+ alignItems : "center" ,
194+ } ,
183195} ) ;
You can’t perform that action at this time.
0 commit comments