@fto-consult/expo-ui 1.5.4 → 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,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
|
-
<
|
|
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
|
-
</
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
};
|
|
18
|
+
uuid : "Unique id du poste de travail",
|
|
19
|
+
},defaultProps);
|