Skip to content

Commit

Permalink
fix loading state visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisTofani committed May 6, 2024
1 parent 96c039b commit 1868144
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions ts/features/bonus/cgn/screens/merchants/CgnMerchantsListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { GlobalState } from "../../../../../store/reducers/types";
import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent";
import {
getValueOrElse,
isError,
isLoading,
isReady
} from "../../../../../common/model/RemoteValue";
Expand Down Expand Up @@ -108,32 +109,32 @@ const CgnMerchantsListScreen: React.FunctionComponent<Props> = (

return (
<SafeAreaView style={IOStyles.flex}>
{isReady(props.onlineMerchants) || isReady(props.offlineMerchants) ? (
<>
<ContentWrapper>
<ListItemHeader
label={I18n.t("bonus.cgn.merchantsList.merchantsAll")}
/>
<TextInput
accessibilityLabel={I18n.t("global.buttons.search")}
icon="search"
value={searchValue}
onChangeText={setSearchValue}
placeholder={I18n.t("global.buttons.search")}
autoFocus={false}
/>
<VSpacer />
</ContentWrapper>
<CgnMerchantsListView
refreshing={
isLoading(props.onlineMerchants) ||
isLoading(props.offlineMerchants)
}
onRefresh={initLoadingLists}
merchantList={merchantList}
onItemPress={onItemPress}
{!(isError(props.onlineMerchants) || isError(props.offlineMerchants)) && (
<ContentWrapper>
<ListItemHeader
label={I18n.t("bonus.cgn.merchantsList.merchantsAll")}
/>
<TextInput
accessibilityLabel={I18n.t("global.buttons.search")}
icon="search"
value={searchValue}
onChangeText={setSearchValue}
placeholder={I18n.t("global.buttons.search")}
autoFocus={false}
/>
</>
<VSpacer />
</ContentWrapper>
)}
{isReady(props.onlineMerchants) || isReady(props.offlineMerchants) ? (
<CgnMerchantsListView
refreshing={
isLoading(props.onlineMerchants) ||
isLoading(props.offlineMerchants)
}
onRefresh={initLoadingLists}
merchantList={merchantList}
onItemPress={onItemPress}
/>
) : (
<LoadingErrorComponent
isLoading={
Expand Down

0 comments on commit 1868144

Please sign in to comment.