@fto-consult/expo-ui 1.5.3 → 1.5.5

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": "1.5.3",
3
+ "version": "1.5.5",
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
  "@expo/html-elements": "^0.2.0",
62
62
  "@expo/metro-config": "^0.4.0",
63
63
  "@expo/webpack-config": "^0.17.2",
64
- "@fto-consult/common": "^1.8.2",
64
+ "@fto-consult/common": "^1.9.0",
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.2.0",
@@ -1,5 +1,5 @@
1
1
  import React from '$react';
2
- import {Text,StyleSheet} from 'react-native';
2
+ import {Text,StyleSheet,Pressable} from 'react-native';
3
3
  import View from "$ecomponents/View";
4
4
  import PropTypes from 'prop-types';
5
5
  import {Colors,StylePropTypes} from "$theme";
@@ -16,9 +16,12 @@ const AvatarTextComponent = (props) => {
16
16
  labelStyle,
17
17
  children,
18
18
  style : customStyle,
19
+ onPress:customOnPress,
20
+ testID : customTestID,
19
21
  } = props;
20
22
  const containerProps = defaultObj(customContainerProps);
21
23
  const size = defaultNumber(customSize,defaultSize);
24
+ const testID = defaultStr(customTestID,"RN_AvatarComponent.Text");
22
25
  const style = Object.assign({},StyleSheet.flatten(customStyle));
23
26
  let label = defaultStr(customLabel,children);
24
27
  if(!label) return null;
@@ -40,9 +43,12 @@ const AvatarTextComponent = (props) => {
40
43
  height: size,
41
44
  width: size,
42
45
  };
46
+ const onPress = typeof customOnPress =='function' ? customOnPress : undefined;
47
+ const C = onPress? Pressable : View;
43
48
  return (
44
- <View pointerEvents='none' {...containerProps} style={[styles.container,style,containerProps.style,textContainerStyle,{borderRadius:size/2}]}>
49
+ <C testID={testID+"_Container"} pointerEvents={onPress?"auto":'none'} {...containerProps} style={[styles.container,style,containerProps.style,textContainerStyle,{borderRadius:size/2}]}>
45
50
  { <Text
51
+ testID={testID}
46
52
  style={[{
47
53
  color: color,
48
54
  fontSize: size / 2.5,
@@ -51,7 +57,7 @@ const AvatarTextComponent = (props) => {
51
57
  >
52
58
  {l}
53
59
  </Text>}
54
- </View>
60
+ </C>
55
61
  );
56
62
  };
57
63
 
@@ -59,7 +65,7 @@ AvatarTextComponent.propTypes = {
59
65
  label: PropTypes.string,
60
66
  size: PropTypes.number,
61
67
  color: PropTypes.string,
62
- labelStyle: PropTypes.object,
68
+ labelStyle: StylePropTypes,
63
69
  style: StylePropTypes,
64
70
  };
65
71
 
@@ -24,7 +24,8 @@ const AvatarComponent = React.forwardRef((props,ref)=>{
24
24
  if(typeof label =='number') label = label+"";
25
25
  rest = defaultObj(rest);
26
26
  containerProps = defaultObj(containerProps);
27
- size = defaultDecimal(size,defaultSize)
27
+ size = defaultDecimal(size,defaultSize);
28
+ let handleOnPress = false;
28
29
  let cProps = {size};
29
30
  if(source || image || src){
30
31
  Component = AvatarImage;
@@ -32,6 +33,7 @@ const AvatarComponent = React.forwardRef((props,ref)=>{
32
33
  } else if(icon){
33
34
  Component = Avatar.Icon;
34
35
  cProps.icon = icon;
36
+ handleOnPress = true;
35
37
  } else if(label){
36
38
  cProps.label = label;
37
39
  cProps.pointerEvents = "none";
@@ -59,12 +61,13 @@ const AvatarComponent = React.forwardRef((props,ref)=>{
59
61
  {...rest}
60
62
  {...cProps}
61
63
  ref={ref}
64
+ onPress = {!handleOnPress && onPress ? onPress : undefined}
62
65
  title = {onPress?null : defaultVal(toolip,title)}
63
66
  testID = {defaultStr(testID,"RN_AvatarComponent")}
64
67
  style = {style}
65
68
  size= {size}
66
69
  />;
67
- return onPress ? <Tooltip title={title} toolip={toolip} Component = {Pressable} testID={testID+"_Container"} {...containerProps} onPress={onPress}>{c}</Tooltip> : c;
70
+ return onPress && handleOnPress ? <Tooltip title={title} toolip={toolip} Component = {Pressable} testID={testID+"_Container"} {...containerProps} onPress={onPress}>{c}</Tooltip> : c;
68
71
  });
69
72
 
70
73
  AvatarComponent.displayName = "AvatarComponent";
@@ -1,14 +1,19 @@
1
- export default {
1
+ import appConfig from "$capp/config";
2
+ import {defaultObj, extendObj} from "$utils";
3
+ /*** par défaut, il est possible de spécifier les devices props personnalisés pour l'application.
4
+ * Il suffit de les définir dans la props deviceProps du fichier de configuration de l'application
5
+ */
6
+ const defaultProps = defaultObj(appConfig.get("deviceProps"));
7
+ export default extendObj({
2
8
  computerName : "Nom de l'ordinateur",
3
9
  operatingSystem : "Système d'exploitation",
4
10
  osVersion : "Version",
5
11
  model : "Model", //le model du device
6
12
  platform : "Plateforme",
7
13
  computerUserName : "Utilisateur connecté au système",
8
- uuid : "Unique id",
9
14
  deviceId : "ID du poste de travail",
10
15
  id : "Id application", //le bundle id de l'application
11
16
  name : "Nom de l'application", //display name of the app
12
17
  version : "Version de l'application",
13
- storageUsage : "Stockage",
14
- };
18
+ uuid : "Unique id du poste de travail",
19
+ },defaultProps);