@fto-consult/expo-ui 7.0.7 → 7.1.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.0.7",
3
+ "version": "7.1.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -71,7 +71,7 @@
71
71
  "@expo/html-elements": "^0.5.1",
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
- "@fto-consult/common": "^3.70.27",
74
+ "@fto-consult/common": "^3.70.28",
75
75
  "@pchmn/expo-material3-theme": "^1.3.1",
76
76
  "@react-native-async-storage/async-storage": "1.18.2",
77
77
  "@react-native-community/datetimepicker": "7.2.0",
@@ -207,7 +207,8 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
207
207
  });
208
208
  const dataRef = React.useRef(null);
209
209
  const totalRef = React.useRef(0);
210
- const loading = (customIsLoading === true || isLoading || (isValidating && showProgressRef.current));
210
+ const prevIsLoading = React.usePrevious(isLoading);
211
+ const loading = (customIsLoading === true || isLoading || (prevIsLoading && isValidating && showProgressRef.current));
211
212
  const {data,total} = React.useMemo(()=>{
212
213
  if((loading && customIsLoading !== false) || !isObjOrArray(result)){
213
214
  return {data:dataRef.current,total:totalRef.current};
@@ -118,18 +118,25 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
118
118
  const swrRefreshTimeout = defaultNumber(swrConfig?.refreshTimeout,SWR_REFRESH_TIMEOUT)
119
119
  swrConfig = extendObj({
120
120
  provider: () => new Map(),
121
+ refreshWhenOffline : canFetchOffline,
121
122
  isOnline() {
122
123
  /* Customize the network state detector */
123
124
  if(canFetchOffline) return true;
124
125
  return APP.isOnline();
125
126
  },
127
+ onError: (error, key) => {
128
+ if (error.status !== 403 && error.status !== 404) {
129
+ console.log(error," on data fetching for key ",key);
130
+ }
131
+ },
126
132
  isVisible() {
127
133
  const screen = activeScreenRef.current;
128
134
  if(!screen) return false;
129
135
  if(!screensRef.current[screen]){
130
- screensRef.current[screen] = new Date();
136
+ //screensRef.current[screen] = new Date();
131
137
  return false;
132
138
  }
139
+ return true;
133
140
  const date = screensRef.current[screen];
134
141
  const diff = new Date().getTime() - date.getTime();
135
142
  const ret = diff >= swrRefreshTimeout ? true : false;