@fto-consult/expo-ui 2.47.0 → 2.47.2

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.47.0",
3
+ "version": "2.47.2",
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.9.4",
64
+ "@fto-consult/common": "^2.9.6",
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",
@@ -3200,9 +3200,9 @@ export default class CommonDatagridComponent extends AppComponent {
3200
3200
  arg.data = d.data;
3201
3201
  arg.total = defaultNumber(arg.total,arg.data.total);
3202
3202
  }
3203
- if(typeof arg.total != 'number'){
3203
+ /*if(typeof arg.total != 'number'){
3204
3204
  arg.total = Object.size(arg.data);
3205
- }
3205
+ }*/
3206
3206
  const {cb,total,data} = arg;
3207
3207
  return new Promise((resolve)=>{
3208
3208
  this.prepareData(arg,(state)=>{
@@ -9,9 +9,23 @@ const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containe
9
9
  const isKeyboardOpenRef = React.useRef(false);
10
10
  const testID = defaultStr(customTestID,'RN_ScrollViewComponent');
11
11
  containerProps = defaultObj(containerProps)
12
+ const layoutRef = React.useRef(null);
12
13
  const [layout,setLayout] = React.useState(Dimensions.get("window"));
13
14
  const {height} = layout;
15
+ const hasInitializedRef = React.useRef(false);
14
16
  const children = React.useStableMemo(()=>cChildren,[cChildren]);
17
+ const updateLayout = ()=>{
18
+ return new Promise((resolve)=>{
19
+ if(layoutRef.current && layoutRef.current.measureInWindow){
20
+ layoutRef.current.measureInWindow((x, y, width, height) => {
21
+ const r = { x, y, width, height };
22
+ setLayout({...Dimensions.get("window"),layout:r});
23
+ hasInitializedRef.current = true;
24
+ resolve(r);
25
+ });
26
+ }
27
+ })
28
+ }
15
29
  React.useEffect(()=>{
16
30
  const onKeyboardToggle = ({visible})=>{
17
31
  isKeyboardOpenRef.current = visible;
@@ -19,7 +33,7 @@ const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containe
19
33
  const onResizePage = ()=>{
20
34
  setTimeout(()=>{
21
35
  if(isKeyboardOpenRef.current) return;
22
- setLayout(Dimensions.get("window"))
36
+ updateLayout();
23
37
  },300);
24
38
  }
25
39
  APP.on(APP.EVENTS.RESIZE_PAGE,onResizePage);
@@ -29,8 +43,21 @@ const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containe
29
43
  APP.off(APP.EVENTS.KEYBOARD_DID_TOGGLE,onKeyboardToggle);
30
44
  }
31
45
  },[]);
32
- const contentContainerStyle = [{maxHeight:Math.max(height-100,250),width:'100%'},rest.contentContainerStyle];
33
- return <View {...containerProps} style={[theme.styles.w100,containerProps.style]} testID={testID+"_ScrollViewContainer"}>
46
+
47
+ const cStyle = {maxHeight:Math.max(height-100,250),width:'100%'};
48
+ if(isObj(layout.layout) && typeof layout.layout.y =='number'){
49
+ const {layout : {x,y}} = layout;
50
+ const minHeight = height - y;
51
+ if(minHeight> 0){
52
+ cStyle.minHeight = minHeight;
53
+ }
54
+ }
55
+ const contentContainerStyle = [cStyle,rest.contentContainerStyle];
56
+ return <View ref={layoutRef} onLayout={()=>{
57
+ if(!hasInitializedRef.current){
58
+ updateLayout();
59
+ }
60
+ }} {...containerProps} style={[theme.styles.w100,containerProps.style]} testID={testID+"_ScrollViewContainer"}>
34
61
  <ScrollView
35
62
  ref={ref} {...rest}
36
63
  testID={testID}