@fto-consult/expo-ui 2.4.5 → 2.4.7
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
|
@@ -61,7 +61,6 @@ const FabGroupComponent = React.forwardRef((props,innerRef)=>{
|
|
|
61
61
|
act.label = defaultStr(act.label,act.text);
|
|
62
62
|
const a = actionMutator ? actionMutator ({action:act,key:i,isFab:true,fab:true}) : act;
|
|
63
63
|
if(!isObj(a) || !isNonNullString(a.label)) return null;
|
|
64
|
-
a.small = typeof a.small =='boolean'? a.small : false;
|
|
65
64
|
const {perm,isAllowed,primary,secondary,...restItem} = a;
|
|
66
65
|
if(typeof isAllowed =='function' && isAllowed() === false) return null;
|
|
67
66
|
if(isNonNullString(perm) && !Auth.isAllowedFromStr(perm)) return false;
|
|
@@ -8,11 +8,10 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import View from "$ecomponents/View";
|
|
10
10
|
import {FAB,Text,Card,withTheme} from "react-native-paper";
|
|
11
|
-
import
|
|
11
|
+
import colorFn from 'color';
|
|
12
12
|
import PropTypes from "prop-types";
|
|
13
|
-
import { StylePropTypes } from '$theme';
|
|
14
13
|
import Action from "$ecomponents/Form/Action";
|
|
15
|
-
import { disabledStyle,cursorNotAllowed } from '$theme';
|
|
14
|
+
import theme,{ disabledStyle,StylePropTypes,Colors,cursorNotAllowed } from '$theme';
|
|
16
15
|
import {defaultStr} from "$utils";
|
|
17
16
|
|
|
18
17
|
|
|
@@ -24,18 +23,17 @@ const FABGroup = ({
|
|
|
24
23
|
open,
|
|
25
24
|
onPress,
|
|
26
25
|
accessibilityLabel,
|
|
27
|
-
theme,
|
|
28
26
|
label,
|
|
29
27
|
style,
|
|
30
28
|
screenName,
|
|
31
29
|
fabStyle,
|
|
32
30
|
visible,
|
|
33
|
-
testID,
|
|
34
31
|
onStateChange,
|
|
35
32
|
color: colorProp,
|
|
33
|
+
testID,
|
|
36
34
|
...rest
|
|
37
35
|
}) => {
|
|
38
|
-
|
|
36
|
+
testID = defaultStr(testID,"RN_FabGroupComponent")
|
|
39
37
|
const { current: backdrop } = React.useRef(
|
|
40
38
|
new Animated.Value(0)
|
|
41
39
|
);
|
|
@@ -90,11 +88,8 @@ const FABGroup = ({
|
|
|
90
88
|
|
|
91
89
|
const toggle = () => onStateChange({ open: !open });
|
|
92
90
|
|
|
93
|
-
const
|
|
91
|
+
const colors = theme.colors;
|
|
94
92
|
|
|
95
|
-
const labelColor = theme.dark
|
|
96
|
-
? colors.text
|
|
97
|
-
: color(colors.text).fade(theme.ALPHA).rgb().string();
|
|
98
93
|
const backdropOpacity = open
|
|
99
94
|
? backdrop.interpolate({
|
|
100
95
|
inputRange: [0, 0.5, 1],
|
|
@@ -121,9 +116,10 @@ const FABGroup = ({
|
|
|
121
116
|
const Item = isFormAction ? Action : FabItem;
|
|
122
117
|
const itemComponentProps = isFormAction ? {Component : FabItem} : {};
|
|
123
118
|
return (
|
|
124
|
-
<View pointerEvents="box-none" style={[styles.container, style]}>
|
|
125
|
-
<TouchableWithoutFeedback onPress={close}>
|
|
119
|
+
<View testID={testID+"_Container"} pointerEvents="box-none" style={[styles.container, style]}>
|
|
120
|
+
<TouchableWithoutFeedback testID={testID+"_TouchableOpacity"} onPress={close}>
|
|
126
121
|
<Animated.View
|
|
122
|
+
testID={testID+"_AnimatedView"}
|
|
127
123
|
pointerEvents={open ? 'auto' : 'none'}
|
|
128
124
|
style={[
|
|
129
125
|
styles.backdrop,
|
|
@@ -134,12 +130,10 @@ const FABGroup = ({
|
|
|
134
130
|
]}
|
|
135
131
|
/>
|
|
136
132
|
</TouchableWithoutFeedback>
|
|
137
|
-
<SafeAreaView pointerEvents="box-none" style={styles.safeArea}>
|
|
138
|
-
<View pointerEvents={open ? 'box-none' : 'none'}>
|
|
133
|
+
<SafeAreaView testID={testID+"_SafeAreaView"} pointerEvents="box-none" style={styles.safeArea}>
|
|
134
|
+
<View testID={testID+"_ItemsContainer"} style={[styles.itemsContainer]} pointerEvents={open ? 'box-none' : 'none'}>
|
|
139
135
|
{actions.map((it, i) => {
|
|
140
136
|
const itemProps = {
|
|
141
|
-
labelColor : it.labelTextColor ?? it.labelColor ?? labelColor,
|
|
142
|
-
backgroundColor : theme.colors.surface,
|
|
143
137
|
...it,
|
|
144
138
|
open,
|
|
145
139
|
scale:scales[i],
|
|
@@ -148,12 +142,13 @@ const FABGroup = ({
|
|
|
148
142
|
}
|
|
149
143
|
return (
|
|
150
144
|
<View
|
|
145
|
+
testID={testID+"_Item_"+i}
|
|
151
146
|
key={i} // eslint-disable-line react/no-array-index-key
|
|
152
147
|
style={[
|
|
153
148
|
styles.item,
|
|
154
149
|
{
|
|
155
150
|
marginHorizontal:
|
|
156
|
-
typeof it.small
|
|
151
|
+
typeof it.small || it.small ? 24 : 16,
|
|
157
152
|
},
|
|
158
153
|
]}
|
|
159
154
|
pointerEvents={open ? 'box-none' : 'none'}
|
|
@@ -278,10 +273,12 @@ FABGroup.propTypes = {
|
|
|
278
273
|
}
|
|
279
274
|
|
|
280
275
|
|
|
281
|
-
|
|
282
|
-
const {children,label,disabled:customDisabled,pointerEvents,open,close,testID:customTestID,labelStyle,labelColor,accessibilityLabel,icon,backgroundColor,scale,opacity,color,style,small,onPress,...rest} = props;
|
|
276
|
+
const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,open,close,testID:customTestID,labelStyle,accessibilityLabel,icon,backgroundColor,scale,opacity,color,style,small,onPress}){
|
|
283
277
|
const disabled = typeof customDisabled =='boolean'? customDisabled : false;
|
|
284
|
-
const testID = defaultStr(customTestID,"
|
|
278
|
+
const testID = defaultStr(customTestID,"RN_FabItemComponent")
|
|
279
|
+
style = StyleSheet.flatten(style) || {};
|
|
280
|
+
color = Colors.isValid(color)? color : style.color;
|
|
281
|
+
backgroundColor = Colors.isValid(backgroundColor)? backgroundColor : style.backgroundColor;
|
|
285
282
|
const _onPress = ()=>{
|
|
286
283
|
if(onPress){
|
|
287
284
|
onPress();
|
|
@@ -297,11 +294,12 @@ export const FabItem = function(props){
|
|
|
297
294
|
style={
|
|
298
295
|
[
|
|
299
296
|
styles.label,
|
|
297
|
+
labelStyle,
|
|
300
298
|
{
|
|
301
299
|
transform: [{ scale }],
|
|
302
300
|
opacity,
|
|
301
|
+
backgroundColor,
|
|
303
302
|
},
|
|
304
|
-
labelStyle,
|
|
305
303
|
]
|
|
306
304
|
}
|
|
307
305
|
onPress={_onPress}
|
|
@@ -314,28 +312,28 @@ export const FabItem = function(props){
|
|
|
314
312
|
accessibilityComponentType="button"
|
|
315
313
|
accessibilityRole="button"
|
|
316
314
|
>
|
|
317
|
-
<Text testID={testID+"_Label"} style={{ color
|
|
315
|
+
<Text testID={testID+"_Label"} style={{ color}}>
|
|
318
316
|
{label}
|
|
319
317
|
</Text>
|
|
320
318
|
</Card>
|
|
321
319
|
</View>
|
|
322
320
|
) : null}
|
|
323
321
|
<FAB
|
|
324
|
-
small={typeof small
|
|
322
|
+
small={typeof small =='boolean' ? small : true}
|
|
325
323
|
icon={icon}
|
|
326
324
|
color={color}
|
|
327
325
|
disabled = {disabled}
|
|
328
326
|
pointerEvents={pointerEvents}
|
|
329
327
|
style={
|
|
330
328
|
[
|
|
331
|
-
{
|
|
332
|
-
transform: [{ scale}],
|
|
333
|
-
opacity,
|
|
334
|
-
backgroundColor,
|
|
335
|
-
},
|
|
336
329
|
style,
|
|
337
330
|
dStyle,
|
|
338
331
|
disabled? cursorNotAllowed : null,
|
|
332
|
+
{
|
|
333
|
+
transform: [{ scale}],
|
|
334
|
+
opacity,
|
|
335
|
+
backgroundColor,
|
|
336
|
+
},
|
|
339
337
|
]
|
|
340
338
|
}
|
|
341
339
|
onPress={_onPress}
|
|
@@ -354,10 +352,14 @@ export const FabItem = function(props){
|
|
|
354
352
|
</>
|
|
355
353
|
}
|
|
356
354
|
|
|
355
|
+
export const FabItem = theme.withStyles(_FabItem,{displayName:"FabItemComponent",mode:"contained"});
|
|
357
356
|
const styles = StyleSheet.create({
|
|
358
357
|
safeArea: {
|
|
359
358
|
alignItems: 'flex-end',
|
|
360
359
|
},
|
|
360
|
+
itemsContainer : {
|
|
361
|
+
marginBottom : 70,
|
|
362
|
+
},
|
|
361
363
|
container: {
|
|
362
364
|
...StyleSheet.absoluteFillObject,
|
|
363
365
|
justifyContent: 'flex-end',
|