App : plus de « tirer pour actualiser » (accueil, statistiques, historique)
Les données se rechargent à l'ouverture de chaque écran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a510efc496
commit
68a81ddbf3
3 changed files with 10 additions and 27 deletions
|
|
@ -84,10 +84,10 @@ export default function History() {
|
|||
contentContainerStyle={{ paddingHorizontal: 16, paddingBottom: 32 }}
|
||||
onEndReached={() => cursor && !loading && load(false)}
|
||||
onEndReachedThreshold={0.5}
|
||||
refreshing={loading && items.length === 0}
|
||||
onRefresh={() => load(true)}
|
||||
bounces={false}
|
||||
overScrollMode="never"
|
||||
ListEmptyComponent={!loading ? <T v="muted" style={{ textAlign: 'center', marginTop: 40 }}>Aucune opération sur la période.</T> : null}
|
||||
ListFooterComponent={loading && items.length > 0 ? <ActivityIndicator style={{ margin: 16 }} /> : null}
|
||||
ListFooterComponent={loading ? <ActivityIndicator style={{ margin: 16 }} /> : null}
|
||||
ItemSeparatorComponent={() => <View style={{ height: 1, backgroundColor: c.border }} />}
|
||||
renderItem={({ item: o }) => {
|
||||
const rejected = o.type === 'REJECTED';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useCallback, useState } from 'react';
|
||||
import { Alert, Linking, Pressable, RefreshControl, ScrollView, View } from 'react-native';
|
||||
import { Alert, Linking, Pressable, ScrollView, View } from 'react-native';
|
||||
import { router, useFocusEffect } from 'expo-router';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import Svg, { Path } from 'react-native-svg';
|
||||
|
|
@ -58,7 +58,6 @@ function Counter() {
|
|||
const { me, logout } = useSession();
|
||||
const store = useStore();
|
||||
const [summary, setSummary] = useState<Summary | null>(null);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [tab, setTab] = useState<'scan' | 'config'>('scan');
|
||||
|
||||
const load = useCallback(async () => {
|
||||
|
|
@ -81,16 +80,9 @@ function Counter() {
|
|||
<SafeAreaView style={{ flex: 1, backgroundColor: c.bg }}>
|
||||
<ScrollView
|
||||
contentContainerStyle={{ padding: 20, gap: 20, flexGrow: 1 }}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
await load();
|
||||
setRefreshing(false);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
// Pas de « tirer pour actualiser » : les chiffres se rechargent à chaque retour sur l'écran.
|
||||
bounces={false}
|
||||
overScrollMode="never"
|
||||
>
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
|
||||
<BrandSymbol size={36} />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useCallback, useState } from 'react';
|
||||
import { Alert, Pressable, RefreshControl, ScrollView, View } from 'react-native';
|
||||
import { Alert, Pressable, ScrollView, View } from 'react-native';
|
||||
import { useFocusEffect } from 'expo-router';
|
||||
import { api, ApiError } from '../src/api';
|
||||
import { describe } from '../src/errors';
|
||||
|
|
@ -37,7 +37,6 @@ export default function StatsScreen() {
|
|||
const [data, setData] = useState<Stats | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [locked, setLocked] = useState(false);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [sending, setSending] = useState<string | null>(null);
|
||||
|
||||
const load = useCallback(async (d: number) => {
|
||||
|
|
@ -94,16 +93,8 @@ export default function StatsScreen() {
|
|||
return (
|
||||
<ScrollView
|
||||
contentContainerStyle={{ padding: 20, gap: 16 }}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
await load(days);
|
||||
setRefreshing(false);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
bounces={false}
|
||||
overScrollMode="never"
|
||||
>
|
||||
<View style={{ flexDirection: 'row', gap: 8 }}>
|
||||
{PERIODS.map(([d, label]) => (
|
||||
|
|
|
|||
Loading…
Reference in a new issue