@fto-consult/expo-ui 4.0.3 → 4.0.4

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": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@ import {isWeb} from "$cplatform";
12
12
  * ce composant a pour but de définir la taille d'un contenu en se basant sur sa positin top, de manière à ce que, le contentu du composant fit
13
13
  * le reste de la taille de la page, avec comme valeur de la props minHeight
14
14
  */
15
- const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,getRenderingStyle,withActivityIndicator,testID,withPadding,maxHeight,minHeight,style,children:cChildren,...rest},ref) => {
15
+ const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,screenIndent,getRenderingStyle,withActivityIndicator,testID,withPadding,paddingBottom,maxHeight,minHeight,style,children:cChildren,...rest},ref) => {
16
16
  testID = defaultStr(testID,'RN_AutoSizerVerticalComponent');
17
17
  const hasUpdateLayoutRef = React.useRef(false);
18
18
  const layoutRef = React.useRef(null);
@@ -56,13 +56,19 @@ const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,getR
56
56
  const hasUpdateLayout = hasUpdateLayoutRef.current;
57
57
  const cStyle ={width:'100%',maxHeight:Math.max(height-100,250)};
58
58
  const contentLayout = defaultObj(layout.layout);
59
- cStyle.minHeight = Math.min(Math.max(layout.height-defaultNumber(contentLayout.y),minHeight && minHeight ||250));
60
- const cMaxHeight = layout.height-defaultNumber(contentLayout.y);
59
+ screenIndent = typeof screenIndent =='number' && screenIndent > 50 ? screenIndent : 100;
60
+ const y = Math.abs(defaultNumber(contentLayout.y));
61
+ const heightY = y < height - screenIndent ? y : height - screenIndent;
62
+ cStyle.minHeight = Math.min(Math.max(layout.height-heightY,minHeight && minHeight ||250));
63
+ const cMaxHeight = layout.height-heightY;
61
64
  if(cMaxHeight>=200){
62
65
  cStyle.maxHeight = cMaxHeight;
63
66
  }
64
- if(withPadding !== false){
65
- cStyle.paddingBottom = 50;
67
+ if(typeof paddingBottom =='number'){
68
+ cStyle.paddingBottom = paddingBottom; //: 50;
69
+ }
70
+ if(cStyle.minHeight && cStyle.maxHeight && cStyle.minHeight > cStyle.maxHeight){
71
+ cStyle.minHeight = cStyle.maxHeight;
66
72
  }
67
73
  const restStyle = {};
68
74
  const canUpdate = hasUpdateLayout || hasUpdateLayout || withActivityIndicator === false;
@@ -97,4 +103,5 @@ AutoSizerVerticalComponent.propTypes = {
97
103
  withActivityIndicator : PropTypes.bool,//si l'on utilisera l'activity indicator pour le chargement du contentu
98
104
  maxHeight : PropTypes.number,
99
105
  minHeight : PropTypes.number,
106
+ paddingBottom : PropTypes.number,
100
107
  }
@@ -80,6 +80,7 @@ const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderIte
80
80
  if(isDOMElement(target) && onContentSizeChange){
81
81
  const {nativeEvent:{contentSize}} = normalizeEvent({target});
82
82
  setTimeout(()=>{
83
+ target.style.paddingBottom = "50px";
83
84
  if(contentSize.width !== listSize.width || contentSize.height != listSize.height){
84
85
  sizeRef.current = contentSize;
85
86
  onContentSizeChange(contentSize.width,contentSize.height);
@@ -95,7 +96,7 @@ const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderIte
95
96
  React.useOnRender((a,b,c)=>{
96
97
  if(onRender && onRender(a,b,c));
97
98
  },Math.max(Array.isArray(items) && items.length/10 || 0,500))
98
- return <View {...containerProps} {...props} style={[{flex:1},containerProps.style,style,{minWidth:'100%',height:'100%',maxWidth:'100%'}]} onLayout={onLayout} testID={testID}>
99
+ return <View {...containerProps} {...props} style={[{flex:1},containerProps.style,style,autoSizedStyle,{minWidth:'100%',height:'100%',maxWidth:'100%'}]} onLayout={onLayout} testID={testID}>
99
100
  <Virtuoso
100
101
  {...r2}
101
102
  style = {listStyle}
@@ -14,9 +14,8 @@ const normalize = (size)=>{
14
14
  const AutoSizeVerticalList = React.forwardRef(({testID,autoSizerProps,...props},ref)=>{
15
15
  testID = defaultStr(testID,"RN_AutoSizeVerticalListComponent")
16
16
  autoSizerProps = defaultObj(autoSizerProps);
17
- const sizeRef = React.useRef({});
18
- return <AutoSizeVertical withPadding={false} getRenderingStyle={(size)=>{sizeRef.current = normalize(sizeRef.current);}} testID={testID+"_AutoSizerVertical"} {...autoSizerProps} >
19
- <List {...props} autoSizedStyle = {sizeRef.current} style={[props.style,sizeRef.current]} ref={ref}/>
17
+ return <AutoSizeVertical withPadding={false} testID={testID+"_AutoSizerVertical"} {...autoSizerProps} >
18
+ <List {...props} style={[props.style]} ref={ref}/>
20
19
  </AutoSizeVertical>
21
20
  })
22
21