@fto-consult/expo-ui 6.74.8 → 6.74.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -167,9 +167,6 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
167
167
|
const limitRef = React.useRef(!canHandleLimit ?0 : defaultNumber(getSessionData("limit"),500));
|
168
168
|
const isInitializedRef = React.useRef(false);
|
169
169
|
testID = defaultStr(testID,"RNSWRDatagridComponent");
|
170
|
-
React.useEffect(()=>{
|
171
|
-
showProgressRef.current = false;
|
172
|
-
},[showProgressRef.current.current]);
|
173
170
|
const {error, isValidating,isLoading,data:result,refresh} = useSWR(fetchPath,{
|
174
171
|
fetcher : (url,opts)=>{
|
175
172
|
if(!isInitializedRef.current) {
|
@@ -292,6 +289,9 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
292
289
|
}
|
293
290
|
});
|
294
291
|
});
|
292
|
+
React.useEffect(()=>{
|
293
|
+
showProgressRef.current = false;
|
294
|
+
});
|
295
295
|
return (
|
296
296
|
<Datagrid
|
297
297
|
testID = {testID}
|
package/src/context/Provider.js
CHANGED
@@ -112,9 +112,7 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
|
|
112
112
|
///swr config settings
|
113
113
|
///garde pour chaque écran sa date de dernière activité
|
114
114
|
const screensRef = React.useRef({});//la liste des écrans actifs
|
115
|
-
const isScreenFocusedRef = React.useRef(true);
|
116
115
|
const activeScreenRef = React.useRef('');
|
117
|
-
const prevActiveScreenRef = React.useRef('');
|
118
116
|
const appStateRef = React.useRef({});
|
119
117
|
const swrRefreshTimeout = defaultNumber(swrConfig?.refreshTimeout,SWR_REFRESH_TIMEOUT)
|
120
118
|
swrConfig = extendObj({
|
@@ -133,8 +131,11 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
|
|
133
131
|
}
|
134
132
|
const date = screensRef.current[screen];
|
135
133
|
const diff = new Date().getTime() - date.getTime();
|
136
|
-
|
137
|
-
|
134
|
+
const ret = diff >= swrRefreshTimeout ? true : false;
|
135
|
+
if(ret){
|
136
|
+
screensRef.current[screen] = new Date();
|
137
|
+
}
|
138
|
+
return ret;
|
138
139
|
},
|
139
140
|
initFocus(callback) {
|
140
141
|
let appState = AppState.currentState
|
@@ -283,21 +284,15 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
|
|
283
284
|
const {linking} = navigation;
|
284
285
|
React.useEffect(()=>{
|
285
286
|
const onScreenFocus = ({sanitizedName})=>{
|
286
|
-
prevActiveScreenRef.current = activeScreenRef.current;
|
287
287
|
if(activeScreenRef.current){
|
288
288
|
screensRef.current[activeScreenRef.current] = null;
|
289
289
|
}
|
290
290
|
screensRef.current[sanitizedName] = new Date();
|
291
291
|
activeScreenRef.current = sanitizedName;
|
292
|
-
isScreenFocusedRef.current = true;
|
293
|
-
}, onScreenBlur = ()=>{
|
294
|
-
isScreenFocusedRef.current = false;
|
295
292
|
}
|
296
293
|
APP.on(APP.EVENTS.SCREEN_FOCUS,onScreenFocus);
|
297
|
-
APP.on(APP.EVENTS.SCREEN_BLUR,onScreenBlur);
|
298
294
|
return ()=>{
|
299
295
|
APP.off(APP.EVENTS.SCREEN_FOCUS,onScreenFocus);
|
300
|
-
APP.off(APP.EVENTS.SCREEN_BLUR,onScreenBlur);
|
301
296
|
}
|
302
297
|
},[]);
|
303
298
|
return <ExpoUIContext.Provider
|