@fto-consult/expo-ui 6.41.1 → 6.42.1

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.
@@ -74,10 +74,6 @@ module.exports = (opts)=>{
74
74
  r.$ehooks = path.resolve(expo,"context","hooks");
75
75
  ///le chemin racine du projet expo-ui
76
76
  r["$expo-ui-root-path"] = r["$expo-ui-root"]= path.resolve(expo,"..");
77
-
78
-
79
- ///on génère les librairies open sources utilisées par l'application
80
- require("./find-licenses");
81
77
  const $assets = r.$assets;
82
78
  const $electron = path.resolve(dir,"electron");
83
79
  const electronPaths = {
package/metro.config.js CHANGED
@@ -39,5 +39,7 @@ module.exports = function(opts){
39
39
  config.platforms.push(p);
40
40
  }
41
41
  });*/
42
+ ///on génère les librairies open sources utilisées par l'application
43
+ require("./find-licenses");
42
44
  return config;
43
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.41.1",
3
+ "version": "6.42.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  animations.entering.duration(duration).withCallback(enteringCallback);
19
19
  animations.exiting.duration(duration).withCallback(exitingCallback);
20
20
  } else {
21
- animations = getDefaultAnimation({duration,enteringCallback,exitingCallback,callback});
21
+ animations = getDefaultAnimation({duration,enteringCallback,exitingCallback});
22
22
  }
23
23
 
24
24
  return <Animated.View
@@ -6,7 +6,7 @@ import Label from "$ecomponents/Label";
6
6
  import { renderActions } from "$ecomponents/Dialog";
7
7
  import {isObjOrArray,defaultVal,defaultObj} from "$cutils";
8
8
  import {renderSplitedActions} from "$ecomponents/AppBar/utils";
9
- import {isWeb,isNativeMobile} from "$cplatform";
9
+ import {isWeb,isNativeMobile,isTouchDevice} from "$cplatform";
10
10
  import Divider from "$ecomponents/Divider";
11
11
  import {isMobileOrTabletMedia} from "$cplatform/dimensions";
12
12
  import APP from "$capp/instance";
@@ -14,10 +14,10 @@ import KeyboardAvoidingView from "$ecomponents/KeyboardAvoidingView";
14
14
  import {Elevations} from "$ecomponents/Surface";
15
15
  import {defaultStr} from "$cutils";
16
16
  import View from "$ecomponents/View";
17
- import {Easing} from "react-native";
18
17
  import Portal from "$ecomponents/Portal";
19
18
  import { ScrollView } from "react-native";
20
19
  import BackHandler from "$ecomponents/BackHandler";
20
+ import Reanimated, { useSharedValue,withTiming,useAnimatedStyle, } from 'react-native-reanimated';
21
21
  import {
22
22
  Pressable,
23
23
  Animated,
@@ -27,7 +27,7 @@ import {
27
27
  Button,
28
28
  Platform
29
29
  } from "react-native";
30
-
30
+ import Animation from "$ecomponents/Animation";
31
31
  export const defaultHeight = 300;
32
32
 
33
33
  const useNativeDriver = false;
@@ -75,29 +75,20 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
75
75
  } else {
76
76
  height = Math.max(winHeight/3,defaultHeight);
77
77
  }
78
- const [state,setState] = React.useState({
79
- animatedHeight: new Animated.Value(0),
80
- pan: new Animated.ValueXY(),
81
- visible : typeof customVisible === 'boolean'?customVisible : false,
82
- });
78
+ const [pan] = React.useState(new Animated.ValueXY());
79
+ const [visible,setVisible] = React.useState(typeof customVisible === 'boolean'?customVisible : false);
80
+ const heightRef = React.useRef(height);
81
+ heightRef.current = height;
83
82
  const isMounted = React.useIsMounted();
84
- const {pan,animatedHeight,visible} = state;
85
83
  const prevVisible = React.usePrevious(visible);
86
- const forceCloseModal = ()=>{
87
- setState({
88
- ...state,
89
- visible:false,
90
- animatedHeight: new Animated.Value(0)
91
- });
92
- }
93
-
84
+ const animatedHeight = useSharedValue(0);
85
+ const hasCallCallbackRef = React.useState(false);
86
+ const visibleRef = React.useRef(visible);
87
+ visibleRef.current = visible;
94
88
  const open = ()=>{
95
89
  if(!isMounted() || visible)return;
96
- setState({...state,visible:true});
90
+ setVisible(true);
97
91
  };
98
- const getAnimValue = ()=>{
99
- return animatedHeight?.__getValue();
100
- }
101
92
  const subscription = React.useRef(null);
102
93
  const handleBack = React.useCallback((e)=>{
103
94
  if (dismissable) {
@@ -120,43 +111,58 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
120
111
  handleBack
121
112
  );
122
113
  }
123
- const closeModal = ()=>{
114
+
115
+ const closeModal = (cb)=>{
124
116
  removeListeners();
125
117
  if(!isMounted()) return;
126
- const value = getAnimValue();
127
- if(animateOnClose === false || typeof value =='number' && value <= minClosingHeight){
128
- return forceCloseModal();
118
+ pan.setValue({ x: 0, y: 0 });
119
+ const callback = ()=>{
120
+ if(hasCallCallbackRef.current) return;
121
+ if(visibleRef.current){
122
+ setVisible(false);
123
+ }
124
+ if(typeof cb =='function'){
125
+ cb();
126
+ }
127
+ hasCallCallbackRef.current = true;
128
+ };
129
+ hasCallCallbackRef.current = false;
130
+ if(animatedHeight.value != 0){
131
+ animatedHeight.value = withTiming(0,{
132
+ duration: closeDuration,
133
+ callback,
134
+ });
135
+ setTimeout(callback,closeDuration+100);
136
+ } else {
137
+ callback();
129
138
  }
130
- return Animated.timing(animatedHeight, {
131
- useNativeDriver,
132
- toValue: minClosingHeight,
133
- easing : Easing.linear,
134
- duration: closeDuration
135
- }).start(()=>{
136
- pan.setValue({ x: 0, y: 0 });
137
- forceCloseModal();
138
- });
139
139
  }
140
140
  const [panResponder] = React.useState(PanResponder.create({
141
141
  onStartShouldSetPanResponder: () => closeOnDragDown,
142
142
  onPanResponderMove: (e, gestureState) => {
143
- if (gestureState.dy > 0) {
144
- Animated.event([null, { dy: pan.y }], { useNativeDriver})(e, gestureState);
143
+ const diff = gestureState.dy > 0 ? animatedHeight.value - gestureState.dy : Math.min(heightRef.current,animatedHeight.value-gestureState.dy);
144
+ if(diff >0 && diff !== animatedHeight.value){
145
+ animatedHeight.value = withTiming(diff,{duration:100});
145
146
  }
146
147
  },
147
- onPanResponderRelease: (e, gestureState) => {
148
+ onPanResponderRelease: (e, gestureState) => {
149
+ const height = animatedHeight.value;
148
150
  if (height/3 - gestureState.dy < 0) {
149
151
  closeModal();
150
- } else {
151
- Animated.spring(pan, { toValue: { x: 0, y: 0 }, useNativeDriver}).start();
152
152
  }
153
153
  }
154
154
  }))
155
-
155
+ const animatedStyles = useAnimatedStyle(() => ({
156
+ height : animatedHeight.value,
157
+ transform :[{ translateX: 0 }],
158
+ }));
156
159
  React.useEffect(()=>{
157
160
  if(typeof customVisible !=='boolean' || customVisible === visible) return;
158
161
  if(customVisible){
159
- setState({...state,visible:true});
162
+ if(animatedHeight.value >0){
163
+ animatedHeight.value = withTiming(0);
164
+ }
165
+ setVisible(true);
160
166
  } else {
161
167
  closeModal();
162
168
  }
@@ -169,29 +175,25 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
169
175
  if(visible){
170
176
  addListener();
171
177
  pan.setValue({ x: 0, y: 0 });
172
- Animated.timing(animatedHeight, {
173
- useNativeDriver,
174
- toValue: height,
178
+ animatedHeight.value = withTiming(height,{
179
+ callback : ()=>{
180
+ if (typeof onOpen === "function") onOpen(props)
181
+ },
175
182
  duration: openDuration,
176
- easing : Easing.linear,
177
- }).start(()=>{
178
- if (typeof onOpen === "function") onOpen(props)
179
- });
183
+ })
180
184
  } else {
181
- if (typeof onClose === "function") onClose(props);
182
- else if(onDismiss){
183
- onDismiss(props);
184
- }
185
+ closeModal(()=>{
186
+ if (typeof onClose === "function") onClose(props);
187
+ else if(onDismiss){
188
+ onDismiss(props);
189
+ }
190
+ });
185
191
  }
186
192
  },[visible])
187
193
 
188
194
  const panStyle = {
189
195
  transform: pan.getTranslateTransform()
190
196
  };
191
- const slideUp = animatedHeight.interpolate({
192
- inputRange: [0, 1],
193
- outputRange: [0, height],
194
- });
195
197
  const actionProps = Object.assign({},rest.actionProps);
196
198
  const backdropProps = defaultObj(backdropProps);
197
199
  //actionProps.size = actionProps.size || 25;
@@ -236,7 +238,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
236
238
  React.setRef(ref,null);
237
239
  }
238
240
  },[]);
239
- const dragFromTopOnly = typeof dragFromTopOnly ==='boolean' ? dragFromTopOnly : withScrollView !== false ? true : !isWeb();
241
+ const dragFromTopOnly = typeof dragFromTopOnly ==='boolean' ? dragFromTopOnly : withScrollView !== false ? true : isTouchDevice();
240
242
  const testID = defaultStr(customTestID,"RN_BottomSheetComponent");
241
243
  const containerProps = defaultObj(customContainerProps);
242
244
  const elevation = typeof customElevation =='number'? Math.ceil(customElevation) : 10;
@@ -257,10 +259,10 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
257
259
  activeOpacity={1}
258
260
  onPress={() => (closeOnPressMask && dismissable !== false ? closeModal() : null)}
259
261
  />
260
- <Animated.View
262
+ <Reanimated.View
261
263
  {...(!dragFromTopOnly && panResponder.panHandlers)}
262
264
  testID = {testID+"_Container"} {...containerProps}
263
- style={[styles.container,containerProps.style,{height:animatedHeight},{borderTopWidth:borderWidth,borderTopColor:borderColor,backgroundColor:theme.colors.surface},Elevations[elevation],panStyle,slideUp]}
265
+ style={[styles.container,containerProps.style,{borderTopWidth:borderWidth,borderTopColor:borderColor,backgroundColor:theme.colors.surface},Elevations[elevation],panStyle,styles.animated,animatedStyles]}
264
266
  >
265
267
  {closeOnDragDown && (
266
268
  <View
@@ -293,7 +295,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
293
295
  <KeyboardAvoidingView testID={testID+"_KeyboardAvoidingView"}>{children}</KeyboardAvoidingView>
294
296
  </View>}
295
297
  </View>
296
- </Animated.View>
298
+ </Reanimated.View>
297
299
  </View>
298
300
  </Portal>
299
301
  );
@@ -28,6 +28,9 @@ export default class FormDataComponent extends AppComponent{
28
28
  },
29
29
  });
30
30
  }
31
+ isFormList(){
32
+ return false;
33
+ }
31
34
  getForm (){
32
35
  return getForm(this.getFormName());
33
36
  }
@@ -520,7 +520,7 @@ export default class FormListComponent extends AppComponent {
520
520
  this.restDatagridProps = dgProps;
521
521
  this._onRowsClick = dgProps.onRowPress;
522
522
  listContent = <Datagrid
523
- testID = {testID+"_Datagrid"}
523
+ testID = {testID+"_FormListDatagrid"}
524
524
  {...dgProps}
525
525
  onRowPress = {this.onRowPress.bind(this)}
526
526
  rowKey = {dgProps.rowKey === false || this.props.rowKey === false ? undefined : defaultStr(dgProps.rowKey,this.props.rowKey,dgProps.indexField,this.props.indexField,'_id')}
@@ -547,8 +547,8 @@ export default class FormListComponent extends AppComponent {
547
547
  if(!React.isValidElement(addIcon,true)){
548
548
  addIcon = isObj(addIcon) ? <Button {...addIconObj} {...addIcon}/> : null;
549
549
  }
550
- listContent = <View testID={testID+"_List"} {...ListProps}>
551
- <View testID={testID+"_HeaderContainer"} style={[styles.row]}>
550
+ listContent = <View testID={testID+"_FormList"} {...ListProps} style={[styles.listContainer,ListProps.styles]}>
551
+ <View testID={testID+"_FormListHeaderContainer"} style={[styles.row]}>
552
552
  {!isCurrentDisplayTable && addIcon ? <List.Subheader>{addIcon}</List.Subheader> : null}
553
553
  {canRenderTable && this.canChangeDisplayType && <List.Subheader >
554
554
  <Button
@@ -561,7 +561,7 @@ export default class FormListComponent extends AppComponent {
561
561
  </Button>
562
562
  </List.Subheader>}
563
563
  </View>
564
- <View testID={testID+"_ListWrapper"} style={[theme.styles.ph1]}>
564
+ <View testID={testID+"_FormListWrapper"} style={[theme.styles.ph1]}>
565
565
  <FlashList
566
566
  items = {allData}
567
567
  responsive
@@ -647,7 +647,7 @@ export default class FormListComponent extends AppComponent {
647
647
  </View>
648
648
  </View>
649
649
  }
650
- return <View testID={testID+"_Container"}>
650
+ return <View testID={testID+"_FormListContainer"} style={[styles.container]}>
651
651
  {listContent}
652
652
  </View>
653
653
  }
@@ -792,5 +792,11 @@ const styles = StyleSheet.create({
792
792
  },
793
793
  item : {
794
794
  paddingRight : 0,
795
- }
795
+ },
796
+ listContainer : {
797
+ width : "100%"
798
+ },
799
+ container : {
800
+ width : "100%"
801
+ },
796
802
  })
@@ -11,6 +11,9 @@ export default class FormDataListScreen extends FormData{
11
11
  }
12
12
  })
13
13
  }
14
+ isFormList(){
15
+ return true;
16
+ }
14
17
  isDocEditing(data){
15
18
  if(super.isDocEditing(data)) return true;
16
19
  const {indexField,isDocUpdate,isDocEditing} = this.props;
@@ -1 +1 @@
1
- module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.39.2","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"},"@emotion/native":{"version":"11.11.0","url":"https://emotion.sh","license":"MIT"},"@emotion/react":{"version":"11.11.1","url":"https://github.com/emotion-js/emotion/tree/main/packages/react","license":"MIT"},"@expo/html-elements":{"version":"0.5.1","url":"https://github.com/expo/expo/tree/main/packages/html-elements","license":"MIT"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/vector-icons":{"version":"13.0.0","url":"https://expo.github.io/vector-icons","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"@faker-js/faker":{"version":"8.0.2","url":"https://github.com/faker-js/faker.git","license":"MIT"},"@fto-consult/common":{"version":"3.39.1","url":"https://github.com/borispipo/common#readme","license":"ISC"},"@pchmn/expo-material3-theme":{"version":"1.3.1","url":"https://github.com/pchmn/expo-material3-theme#readme","license":"MIT"},"@react-native-async-storage/async-storage":{"version":"1.18.2","url":"https://github.com/react-native-async-storage/async-storage#readme","license":"MIT"},"@react-native-community/datetimepicker":{"version":"7.2.0","url":"https://github.com/react-native-community/datetimepicker#readme","license":"MIT"},"@react-native-community/netinfo":{"version":"9.3.10","url":"https://github.com/react-native-netinfo/react-native-netinfo#readme","license":"MIT"},"@react-native/assets-registry":{"version":"0.72.0","url":"git@github.com:facebook/react-native.git","license":"MIT"},"@react-navigation/native":{"version":"6.1.7","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.13","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@react-navigation/stack":{"version":"6.3.17","url":"https://reactnavigation.org/docs/stack-navigator/","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.42.0","url":"https://apexcharts.com","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"},"expo":{"version":"49.0.11","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.4","url":"https://docs.expo.dev/versions/latest/sdk/camera/","license":"MIT"},"expo-clipboard":{"version":"4.3.1","url":"https://docs.expo.dev/versions/latest/sdk/clipboard","license":"MIT"},"expo-font":{"version":"11.4.0","url":"https://docs.expo.dev/versions/latest/sdk/font/","license":"MIT"},"expo-image-picker":{"version":"14.3.2","url":"https://docs.expo.dev/versions/latest/sdk/imagepicker/","license":"MIT"},"expo-linking":{"version":"5.0.2","url":"https://docs.expo.dev/versions/latest/sdk/linking","license":"MIT"},"expo-sqlite":{"version":"11.3.3","url":"https://docs.expo.dev/versions/latest/sdk/sqlite/","license":"MIT"},"expo-status-bar":{"version":"1.6.0","url":"https://docs.expo.dev/versions/latest/sdk/status-bar/","license":"MIT"},"expo-system-ui":{"version":"2.4.0","url":"https://docs.expo.dev/versions/latest/sdk/system-ui","license":"MIT"},"expo-web-browser":{"version":"12.3.2","url":"https://docs.expo.dev/versions/latest/sdk/webbrowser/","license":"MIT"},"file-saver":{"version":"2.0.5","url":"https://github.com/eligrey/FileSaver.js#readme","license":"MIT"},"fs-extra":{"version":"11.1.1","url":"https://github.com/jprichardson/node-fs-extra","license":"MIT"},"google-libphonenumber":{"version":"3.2.33","url":"https://ruimarinho.github.io/google-libphonenumber/","license":"(MIT AND Apache-2.0)"},"htmlparser2-without-node-native":{"version":"3.9.2","url":"git://github.com/fb55/htmlparser2.git","license":"MIT"},"is-plain-obj":{"version":"4.1.0","license":"MIT"},"pdfmake":{"version":"0.2.7","url":"http://pdfmake.org","license":"MIT"},"process":{"version":"0.11.10","url":"git://github.com/shtylman/node-process.git","license":"MIT"},"prop-types":{"version":"15.8.1","url":"https://facebook.github.io/react/","license":"MIT"},"react":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-content-loader":{"version":"6.2.1","url":"https://github.com/danilowoz/react-content-loader","license":"MIT"},"react-dom":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-native":{"version":"0.72.4","license":"MIT"},"react-native-big-list":{"version":"1.6.1","url":"https://marcocesarato.github.io/react-native-big-list-docs/","license":"GPL-3.0-or-later"},"react-native-blob-util":{"version":"0.18.6","url":"https://github.com/RonRadtke/react-native-blob-util","license":"MIT"},"react-native-gesture-handler":{"version":"2.12.1","url":"https://github.com/software-mansion/react-native-gesture-handler#readme","license":"MIT"},"react-native-iphone-x-helper":{"version":"1.3.1","url":"https://github.com/ptelad/react-native-iphone-x-helper#readme","license":"MIT"},"react-native-mime-types":{"version":"2.4.0","license":"MIT"},"react-native-paper":{"version":"5.10.4","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.19.3","url":"https://github.com/web-ridge/react-native-paper-dates#readme","license":"MIT"},"react-native-reanimated":{"version":"3.3.0","url":"https://github.com/software-mansion/react-native-reanimated#readme","license":"MIT"},"react-native-safe-area-context":{"version":"4.6.3","url":"https://github.com/th3rdwave/react-native-safe-area-context#readme","license":"MIT"},"react-native-screens":{"version":"3.22.1","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"react-native-svg":{"version":"13.9.0","url":"https://github.com/react-native-community/react-native-svg","license":"MIT"},"react-native-web":{"version":"0.19.8","url":"git://github.com/necolas/react-native-web.git","license":"MIT"},"react-native-webview":{"version":"13.2.2","url":"https://github.com/react-native-webview/react-native-webview#readme","license":"MIT"},"react-virtuoso":{"version":"4.5.1","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"4.1.1","url":"https://github.com/vseventer/sharp-cli","license":"MIT"},"tippy.js":{"version":"6.3.7","url":"https://atomiks.github.io/tippyjs/","license":"MIT"},"uninstall":{"version":"0.0.0","license":"MIT"},"websql":{"version":"2.0.3","url":"git://github.com/nolanlawson/node-websql.git","license":"Apache-2.0"},"xlsx":{"version":"0.18.5","url":"https://sheetjs.com/","license":"Apache-2.0"}};
1
+ module.exports = {"@fto-consult/expo-ui":{"version":"6.41.1","url":"https://github.com/borispipo/expo-ui#readme","license":"ISC"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"}};