@fto-consult/expo-ui 2.43.3 → 2.44.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": "2.43.3",
3
+ "version": "2.44.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  "@emotion/native": "^11.10.0",
62
62
  "@expo/html-elements": "^0.2.0",
63
63
  "@expo/vector-icons": "^13.0.0",
64
- "@fto-consult/common": "^2.4.8",
64
+ "@fto-consult/common": "^2.5.2",
65
65
  "@gorhom/portal": "^1.0.14",
66
66
  "@react-native-async-storage/async-storage": "~1.17.3",
67
67
  "@react-native-community/datetimepicker": "6.5.2",
@@ -1,7 +1,7 @@
1
1
  /**** see : https://github.com/danilowoz/react-content-loader */
2
2
  import {defaultObj} from "$utils";
3
3
  import View from "$ecomponents/View";
4
- import {StyleSheet,Dimensions,useWindowDimensions} from "react-native";
4
+ import {StyleSheet,Dimensions} from "react-native";
5
5
  import React from "react";
6
6
  import ContentLoaderF, {Facebook as CLFacebook,Instagram as CLInstagram} from './Loader';
7
7
  import PropTypes from "prop-types";
@@ -26,7 +26,6 @@ import { evalSingleValue,Footer,getFooterColumnValue,isValidAggregator,extendAgg
26
26
  import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$makePhoneCall";
27
27
  import copyToClipboard from "$capp/clipboard";
28
28
  import { Pressable } from "react-native";
29
- import stableHash from "stable-hash";
30
29
  import DatagridProgressBar from "$ecomponents/Table/ProgressBar";
31
30
  import View from "$ecomponents/View";
32
31
  import {Menu} from "$ecomponents/BottomSheet";
@@ -3383,7 +3382,7 @@ export default class CommonDatagridComponent extends AppComponent {
3383
3382
  return false;
3384
3383
  }
3385
3384
  UNSAFE_componentWillReceiveProps(nextProps){
3386
- if((stableHash(nextProps.data) === stableHash(this.props.data))) {
3385
+ if(React.areEquals(nextProps.data,(this.props.data))) {
3387
3386
  return false;
3388
3387
  }
3389
3388
  this.setIsLoading(true,true);
@@ -1,8 +1,8 @@
1
1
  import {Colors} from "$theme";
2
2
  import React from 'react';
3
3
  import View from "$ecomponents/View";
4
- import {StyleSheet,TouchableWithoutFeedback,ScrollView} from 'react-native';
5
- import {withTheme,TouchableRipple} from "react-native-paper"
4
+ import {StyleSheet,TouchableWithoutFeedback} from 'react-native';
5
+ import ScrollView from "$ecomponents/ScrollView";
6
6
  import Label from "$ecomponents/Label";
7
7
  import Icon from "$ecomponents/Icon"
8
8
  import {defaultObj,isNonNullString,defaultStr} from "$utils";
@@ -4,20 +4,26 @@ import PropTypes from "prop-types";
4
4
  import View from "$ecomponents/View";
5
5
  import theme from "$theme";
6
6
  import {defaultStr,defaultObj} from "$utils";
7
+ import stableHash from "stable-hash";
7
8
  import APP from "$capp/instance";
8
- const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containerProps,mediaQueryUpdateNativeProps,testID:customTestID,children,screenIndent:sIndent,...rest},ref) => {
9
+ const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containerProps,mediaQueryUpdateNativeProps,testID:customTestID,children:cChildren,screenIndent:sIndent,...rest},ref) => {
9
10
  const isKeyboardOpenRef = React.useRef(false);
10
11
  const testID = defaultStr(customTestID,'RN_ScrollViewComponent');
11
12
  containerProps = defaultObj(containerProps)
12
13
  const [layout,setLayout] = React.useState(Dimensions.get("window"));
13
14
  const {height} = layout;
15
+ const [children,setChildren] = React.useState(cChildren);
16
+ const hash = stableHash(cChildren);
17
+ React.useEffect(()=>{
18
+ setChildren(children);
19
+ },[hash]);
14
20
  React.useEffect(()=>{
15
21
  const onKeyboardToggle = ({visible})=>{
16
22
  isKeyboardOpenRef.current = visible;
17
23
  };
18
24
  const onResizePage = ()=>{
19
25
  setTimeout(()=>{
20
- //if(isKeyboardOpenRef.current) return;
26
+ if(isKeyboardOpenRef.current) return;
21
27
  setLayout(Dimensions.get("window"))
22
28
  },300);
23
29
  }
@@ -14,7 +14,6 @@ import Icon from "$ecomponents/Icon";
14
14
  import {isDesktopMedia} from "$cplatform/dimensions";
15
15
  import { matchOperators,getSearchTimeout,canAutoFocusSearchField} from "$ecomponents/Dropdown/utils";
16
16
  import Dialog from "$ecomponents/Dialog";
17
- import stableHash from "stable-hash";
18
17
 
19
18
  const SimpleSelect = React.forwardRef((props,ref)=>{
20
19
  let {style : customStyle,onMount,mode,showSearch,anchorContainerProps,renderText,contentContainerProps,withCheckedIcon,testID,selectionColor,dialogProps,onShow,anchor,onUnmont,controlled,onDismiss,visible:controlledVisible,selectedColor,inputProps,itemProps,itemContainerProps,label,listProps,editable,readOnly,text,filter,renderItem,itemValue,getItemValue,defaultValue,items:menuItems,onPress,onChange,disabled,...rest} = props;
@@ -53,8 +52,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
53
52
  renderText = typeof renderText ==='function'? renderText : ({item,content,index})=>{
54
53
  return React.getTextContent(content);
55
54
  }
56
- const menuItemsHash = stableHash(menuItems);
57
- const items = React.useMemo(()=>{
55
+ const items = React.useStableMemo(()=>{
58
56
  const items = [];
59
57
  selectedRef.current = null;
60
58
  //let currentSelectedValue = value;
@@ -92,7 +90,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
92
90
  });
93
91
  return items;
94
92
  //return ({...state,value:currentSelectedValue,items});
95
- },[menuItemsHash])
93
+ },[menuItems])
96
94
  React.useEffect(()=>{
97
95
  if(compare(defaultValue == value)) return;
98
96
  selectValue(defaultValue);
@@ -1,11 +1,10 @@
1
- import {FlashList,BigList,FlatList} from "$ecomponents/List";
2
1
  import View from "$ecomponents/View";
3
2
  import {defaultObj,defaultStr,debounce,defaultNumber,defaultVal} from "$utils";
4
3
  import PropTypes from "prop-types";
5
4
  export const DEFAULT_COLUMN_WIDTH = 60;
6
5
  import React from "$react";
7
6
  import Label from "$ecomponents/Label";
8
- import { StyleSheet,View as RNView,ScrollView,NativeModules,Dimensions} from "react-native";
7
+ import { StyleSheet,View as RNView,ScrollView,Dimensions} from "react-native";
9
8
  import { getRowStyle } from "$ecomponents/Datagrid/utils";
10
9
  import {isMobileNative} from "$cplatform";
11
10
  import theme from "$theme";
@@ -13,7 +12,6 @@ import AbsoluteScrollView from "./AbsoluteScrollView";
13
12
  import Cell from "./Cell";
14
13
  import Row from "./Row";
15
14
  import List from "./List";
16
- import ProgressBar from "./ProgressBar";
17
15
  const isSCrollingRef = React.createRef();
18
16
  const scrollLists = (opts,refs)=>{
19
17
  refs.map((ref)=>{
@@ -60,7 +58,7 @@ const TableComponent = React.forwardRef(({containerProps,sortedColumn,listContai
60
58
  const hasEmptyData = emptyData && React.isValidElement(emptyData);
61
59
  const layoutRef = React.useRef({});
62
60
  React.useOnRender(onRender);
63
- const preparedColumns = React.useMemo(()=>{
61
+ const preparedColumns = React.useStableMemo(()=>{
64
62
  const cols = {},headers = {},footers = {},filters = {},vColumnsMapping = [],visibleColumns = [],columnsNames = [];
65
63
  let hasFooters = false;
66
64
  columnProps = defaultObj(columnProps);
@@ -12,8 +12,7 @@ import ErrorBoundary from "$ecomponents/ErrorBoundary";
12
12
  import Portal from "$ecomponents/Portal";
13
13
  import theme,{StyleProp} from "$theme";
14
14
  import StatusBar from "$ecomponents/StatusBar";
15
- import { ScrollView } from 'react-native';
16
-
15
+ import ScrollView from "$ecomponents/ScrollView";
17
16
  const getDefaultTitle = (nTitle,returnStr)=>{
18
17
  let titleStr = React.getTextContent(nTitle);
19
18
  if(!titleStr){
@@ -1,5 +1,4 @@
1
1
  import {defaultStr,isNumber,isPromise,defaultVal,extendObj,defaultObj,uniqid,isObj,isObjOrArray} from "$utils";
2
- import stableHash from "stable-hash";
3
2
  import {FormData} from "$ecomponents/Form";
4
3
  import FormDataScreen from "./FormData";
5
4
  import ScreenContainer from "./Screen";
@@ -418,7 +417,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
418
417
  mainContent = ct;
419
418
  } else {
420
419
  mainContent = <View {...contentProps} testID={testID+"_ContentContainer"} style={[styles.container,styles.noPadding]}>
421
- <ScrollView virtualized testID={testID+"_MainContentScrollView"} contentProps={{style:theme.styles.p1}}>
420
+ <ScrollView testID={testID+"_MainContentScrollView"} contentProps={{style:theme.styles.p1}}>
422
421
  <Surface elevation={elevation} testID={testID+"_ContentHeader"} style={[styles.screenContent,theme.styles.p1,header?styles.screenContentWithHeader:null]}>
423
422
  {header}
424
423
  {content}
@@ -431,7 +430,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
431
430
  }
432
431
  } else {
433
432
  mainContent = <Surface {...contentProps} testID={testID+"_MainContentContainer"} elevation={elevation} style={[styles.container,styles.noPadding,{paddingTop:0,marginTop:0}]}>
434
- <ScrollView virtualized testID={testID+"_MainContentScrollViewWithoutTab"}>
433
+ <ScrollView testID={testID+"_MainContentScrollViewWithoutTab"}>
435
434
  <View testID={testID+"_MainContent"} style={[styles.screenContent,!isMobOrTab && theme.styles.p1,header?styles.screenContentWithHeader:null]}>
436
435
  {header}
437
436
  {content}
@@ -567,7 +566,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
567
566
  }
568
567
  UNSAFE_componentWillReceiveProps(nextProps){
569
568
  const {data,datas}= nextProps;
570
- if(stableHash({data,datas}) != stableHash({data:this.state.data,datas:this.state.datas})){
569
+ if(!React.areEquals({data,datas},{data:this.state.data,datas:this.state.datas})){
571
570
  this.setState(this.prepareStateData(nextProps));
572
571
  }
573
572
  return;