@fto-consult/expo-ui 6.41.0 → 6.42.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.
@@ -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/bin/create-app.js CHANGED
@@ -34,6 +34,7 @@ module.exports = function(parsedArgs,{projectRoot:root}){
34
34
  "main": "node_modules/expo/AppEntry.js",
35
35
  "scripts" : {
36
36
  start : "npx expo start -c",
37
+ "dev" : "npx expo start --no-dev --minify -c",
37
38
  "serve-web" : "npx serve web-build --single",
38
39
  "build-web" : "npx expo export:web",
39
40
  "build-android" : "npx eas build --platform android",
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.0",
3
+ "version": "6.42.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -8,7 +8,6 @@
8
8
  "publish1": "npm publish --access=public",
9
9
  "unpublish": "npm -f unpublish @fto-consult/expo-ui",
10
10
  "build-web": "",
11
- "dev": "npx expo start -c --no-minify",
12
11
  "start": "npx expo start --dev --no-minify",
13
12
  "start-d": "npx expo start -c --no-dev --no-minify",
14
13
  "start-p": "npm run start-d",
@@ -44,6 +43,7 @@
44
43
  "update-apexchart": "node ./bin/update-appex-chart.js",
45
44
  "update-appexchart": "npm run update-apexchart",
46
45
  "delete-node-modules": "rimraf ./**/node_modules",
46
+ "dev" : "npx expo start --no-dev --minify -c",
47
47
  "modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'",
48
48
  "update": "npm i expo @emotion/native@latest react-native-big-list@latest apexcharts@latest file-saver@latest fs-extra@latest google-libphonenumber@latest @pchmn/expo-material3-theme@latest @emotion/native@latest @fto-consult/common@latest @react-navigation/stack react-native-blob-util react-native-gesture-handler@latest react-native-iphone-x-helper@latest react-native-mime-types@latest react-native-paper@latest react-native-paper-dates@latest @react-navigation/native@latest @react-navigation/native-stack@latest react-virtuoso@latest tippy.js@latest websql@latest xlsx@latest && npx expo install --fix && npm run update-apexchart && npm run find-licenses"
49
49
  },
@@ -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
@@ -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,Easing, 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,17 @@ 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,setPan] = React.useState(new Animated.ValueXY());
79
+ const [visible,setVisible] = React.useState(typeof customVisible === 'boolean'?customVisible : false);
83
80
  const isMounted = React.useIsMounted();
84
- const {pan,animatedHeight,visible} = state;
85
81
  const prevVisible = React.usePrevious(visible);
86
- const forceCloseModal = ()=>{
87
- setState({
88
- ...state,
89
- visible:false,
90
- animatedHeight: new Animated.Value(0)
91
- });
92
- }
93
-
82
+ const animatedHeight = useSharedValue(0);
83
+ const hasCallCallbackRef = React.useState(false);
84
+
94
85
  const open = ()=>{
95
86
  if(!isMounted() || visible)return;
96
- setState({...state,visible:true});
87
+ setVisible(true);
97
88
  };
98
- const getAnimValue = ()=>{
99
- return animatedHeight?.__getValue();
100
- }
101
89
  const subscription = React.useRef(null);
102
90
  const handleBack = React.useCallback((e)=>{
103
91
  if (dismissable) {
@@ -120,22 +108,30 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
120
108
  handleBack
121
109
  );
122
110
  }
123
- const closeModal = ()=>{
111
+
112
+ const closeModal = (cb)=>{
124
113
  removeListeners();
125
- if(!isMounted()) return;
126
- const value = getAnimValue();
127
- if(animateOnClose === false || typeof value =='number' && value <= minClosingHeight){
128
- return forceCloseModal();
114
+ //if(!isMounted()) return;
115
+ const callback = ()=>{
116
+ if(hasCallCallbackRef.current) return;
117
+ if(visible){
118
+ setVisible(false);
119
+ }
120
+ if(typeof cb =='function'){
121
+ cb();
122
+ }
123
+ hasCallCallbackRef.current = true;
124
+ };
125
+ hasCallCallbackRef.current = false;
126
+ if(animatedHeight.value != 0){
127
+ animatedHeight.value = withTiming(0,{
128
+ duration: closeDuration,
129
+ callback,
130
+ });
131
+ setTimeout(callback,closeDuration+100);
132
+ } else {
133
+ callback();
129
134
  }
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
135
  }
140
136
  const [panResponder] = React.useState(PanResponder.create({
141
137
  onStartShouldSetPanResponder: () => closeOnDragDown,
@@ -152,11 +148,16 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
152
148
  }
153
149
  }
154
150
  }))
155
-
151
+ const animatedStyles = useAnimatedStyle(() => ({
152
+ height : animatedHeight.value,
153
+ }));
156
154
  React.useEffect(()=>{
157
155
  if(typeof customVisible !=='boolean' || customVisible === visible) return;
158
156
  if(customVisible){
159
- setState({...state,visible:true});
157
+ if(animatedHeight.value >0){
158
+ animatedHeight.value = withTiming(0);
159
+ }
160
+ setVisible(true);
160
161
  } else {
161
162
  closeModal();
162
163
  }
@@ -169,29 +170,25 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
169
170
  if(visible){
170
171
  addListener();
171
172
  pan.setValue({ x: 0, y: 0 });
172
- Animated.timing(animatedHeight, {
173
- useNativeDriver,
174
- toValue: height,
173
+ animatedHeight.value = withTiming(height,{
174
+ callback : ()=>{
175
+ if (typeof onOpen === "function") onOpen(props)
176
+ },
175
177
  duration: openDuration,
176
- easing : Easing.linear,
177
- }).start(()=>{
178
- if (typeof onOpen === "function") onOpen(props)
179
- });
178
+ })
180
179
  } else {
181
- if (typeof onClose === "function") onClose(props);
182
- else if(onDismiss){
183
- onDismiss(props);
184
- }
180
+ closeModal(()=>{
181
+ if (typeof onClose === "function") onClose(props);
182
+ else if(onDismiss){
183
+ onDismiss(props);
184
+ }
185
+ });
185
186
  }
186
187
  },[visible])
187
188
 
188
189
  const panStyle = {
189
190
  transform: pan.getTranslateTransform()
190
191
  };
191
- const slideUp = animatedHeight.interpolate({
192
- inputRange: [0, 1],
193
- outputRange: [0, height],
194
- });
195
192
  const actionProps = Object.assign({},rest.actionProps);
196
193
  const backdropProps = defaultObj(backdropProps);
197
194
  //actionProps.size = actionProps.size || 25;
@@ -257,10 +254,10 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
257
254
  activeOpacity={1}
258
255
  onPress={() => (closeOnPressMask && dismissable !== false ? closeModal() : null)}
259
256
  />
260
- <Animated.View
257
+ <Reanimated.View
261
258
  {...(!dragFromTopOnly && panResponder.panHandlers)}
262
259
  testID = {testID+"_Container"} {...containerProps}
263
- style={[styles.container,containerProps.style,{height:animatedHeight},{borderTopWidth:borderWidth,borderTopColor:borderColor,backgroundColor:theme.colors.surface},Elevations[elevation],panStyle,slideUp]}
260
+ style={[styles.container,containerProps.style,{borderTopWidth:borderWidth,borderTopColor:borderColor,backgroundColor:theme.colors.surface},Elevations[elevation],panStyle,animatedStyles]}
264
261
  >
265
262
  {closeOnDragDown && (
266
263
  <View
@@ -293,7 +290,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
293
290
  <KeyboardAvoidingView testID={testID+"_KeyboardAvoidingView"}>{children}</KeyboardAvoidingView>
294
291
  </View>}
295
292
  </View>
296
- </Animated.View>
293
+ </Reanimated.View>
297
294
  </View>
298
295
  </Portal>
299
296
  );
@@ -329,8 +326,8 @@ BottomSheetComponent.defaultProps = {
329
326
  animationType: isNativeMobile ? "slide" : "fade",//Background animation ("none", "fade", "slide")
330
327
  height:undefined,//Height of Bottom Sheet
331
328
  minClosingHeight: 0,//Minimum height of Bottom Sheet before close
332
- openDuration: 300,//Open Bottom Sheet animation duration
333
- closeDuration: 300,
329
+ openDuration: 500,//Open Bottom Sheet animation duration
330
+ closeDuration: 500,
334
331
  closeOnDragDown: true,//Use gesture drag down to close Bottom Sheet
335
332
  dragFromTopOnly: false, //Drag only the top area of the draggableIcon to close Bottom Sheet instead of the whole content
336
333
  closeOnPressMask: true, //Press the area outside to close Bottom Sheet
@@ -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"}};