@widergy/mobile-ui 0.40.1 → 1.1.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.
- package/CHANGELOG.md +921 -0
- package/lib/components/Button/index.js +10 -6
- package/lib/components/Button/styles.js +5 -5
- package/lib/components/Capture/index.js +3 -3
- package/lib/components/Carousel/components/CarouselComponent/index.js +2 -0
- package/lib/components/Carousel/components/CarouselContainer/index.js +2 -10
- package/lib/components/CheckList/components/CheckBoxRenderer/index.js +1 -0
- package/lib/components/CheckList/index.js +5 -3
- package/lib/components/CheckList/proptypes.js +2 -2
- package/lib/components/Checkbox/styles.js +3 -3
- package/lib/components/Dropdown/index.js +12 -10
- package/lib/components/FilePicker/utils.js +2 -2
- package/lib/components/Icon/constants.js +1 -0
- package/lib/components/Icon/index.js +11 -1
- package/lib/components/ImageIcon/index.js +8 -1
- package/lib/components/ImageRadio/index.js +21 -12
- package/lib/components/Loading/index.js +1 -0
- package/lib/components/Overlay/index.js +2 -10
- package/lib/components/PhotoAlbum/index.js +8 -9
- package/lib/components/Picker/index.js +2 -2
- package/lib/components/Portal/components/Manager/index.js +7 -4
- package/lib/components/RadioGroup/components/RadioButton/index.js +5 -5
- package/lib/components/RateChart/components/RateStagesGraph/components/Indicator/index.js +3 -3
- package/lib/components/RateChart/components/RateStagesGraph/components/Indicator/utils.js +1 -1
- package/lib/components/TransformView/constants.js +1 -1
- package/lib/components/TransformView/utils.js +674 -0
- package/lib/components/UTAutocomplete/index.js +4 -4
- package/lib/components/UTBanner/index.js +42 -0
- package/lib/components/UTBanner/styles.js +14 -0
- package/lib/components/UTCBUInput/index.js +2 -2
- package/lib/components/UTHeader/index.js +56 -0
- package/lib/components/UTHeader/styles.js +16 -0
- package/lib/components/UTMenu/components/ListView/index.js +4 -2
- package/lib/components/UTMenu/components/MenuOption/index.js +1 -0
- package/lib/components/UTMenu/index.js +3 -3
- package/lib/components/UTMenu/proptypes.js +2 -2
- package/lib/components/UTOnBoarding/components/CardContent/index.js +3 -3
- package/lib/components/UTOnBoarding/index.js +4 -4
- package/lib/components/UTPasswordField/components/PasswordValidations/index.js +2 -6
- package/lib/components/UTSelect/componentes/MultipleItem/index.js +1 -0
- package/lib/components/UTSelect/proptypes.js +1 -0
- package/lib/components/UTStepFeedback/components/CircleNumber/index.js +12 -10
- package/lib/components/UTStepFeedback/index.js +36 -37
- package/lib/components/UTStepper/components/Connectors/index.js +33 -0
- package/lib/components/UTStepper/components/Connectors/styles.js +26 -0
- package/lib/components/UTStepper/components/Step/index.js +50 -0
- package/lib/components/UTStepper/components/Step/styles.js +47 -0
- package/lib/components/UTStepper/index.js +34 -0
- package/lib/components/UTStepper/styles.js +12 -0
- package/lib/components/UTStepper/types.js +3 -0
- package/lib/components/UTSwitch/proptypes.js +1 -0
- package/lib/components/UTTextInput/components/BaseInput/index.js +10 -12
- package/lib/components/UTTextInput/proptypes.js +1 -0
- package/lib/components/UTTopbar/index.js +64 -0
- package/lib/components/UTTopbar/styles.js +16 -0
- package/lib/components/UTTopbar/types.js +8 -0
- package/lib/components/UTWorkflowContainer/index.js +10 -102
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/BottomStepHandler/index.js +4 -4
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/BottomStepHandler/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/index.js +9 -9
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/index.js +2 -2
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/styles.js +12 -12
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/components/ActionButton/types.js +9 -9
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/index.js +6 -6
- package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/styles.js +3 -3
- package/lib/components/UTWorkflowContainer/versions/V0/index.js +108 -0
- package/lib/components/UTWorkflowContainer/{styles.js → versions/V0/styles.js} +4 -4
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/index.js +35 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/styles.js +13 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/types.js +9 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/constants.js +2 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/index.js +110 -0
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/styles.js +75 -0
- package/lib/components/UTWorkflowContainer/versions/V1/index.js +94 -0
- package/lib/components/UTWorkflowContainer/versions/V1/styles.js +14 -0
- package/lib/components/UTWorkflowContainer/versions/V1/types.js +24 -0
- package/lib/theming/DefaultTheme.js +1 -0
- package/lib/utils/fileUtils.js/index.js +20 -5
- package/package.json +47 -71
- /package/lib/components/UTWorkflowContainer/{README.md → versions/V0/README.md} +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/Header/utils.js +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/constants.js +0 -0
- /package/lib/components/UTWorkflowContainer/{components → versions/V0/components}/StepsHandler/utils.js +0 -0
|
@@ -41,8 +41,8 @@ const Button = ({
|
|
|
41
41
|
disabled || mode === TEXT
|
|
42
42
|
? NO_ELEVATION
|
|
43
43
|
: mode === OUTLINED
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
? NO_ELEVATION
|
|
45
|
+
: elevation || themeStyles.buttonElevation
|
|
46
46
|
}
|
|
47
47
|
style={[
|
|
48
48
|
styles.container,
|
|
@@ -64,13 +64,17 @@ const Button = ({
|
|
|
64
64
|
color={textColor}
|
|
65
65
|
name={icon.name}
|
|
66
66
|
type={icon.type}
|
|
67
|
-
style={[styles.leftIcon, iconStyle]}
|
|
67
|
+
style={[title && styles.leftIcon, iconStyle]}
|
|
68
68
|
size={icon.size || themeStyles.fontSize}
|
|
69
|
+
width={icon.width}
|
|
70
|
+
height={icon.height}
|
|
69
71
|
/>
|
|
70
72
|
)}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
{title && (
|
|
74
|
+
<Label base color={textColor} {...labelProps}>
|
|
75
|
+
{lowerCase ? title : title.toUpperCase()}
|
|
76
|
+
</Label>
|
|
77
|
+
)}
|
|
74
78
|
</View>
|
|
75
79
|
</Touchable>
|
|
76
80
|
</Surface>
|
|
@@ -8,12 +8,12 @@ import { OUTLINED, TEXT, CONTAINED } from './constants';
|
|
|
8
8
|
export const getThemeStyles = theme => {
|
|
9
9
|
const { colors, fonts, button } = theme;
|
|
10
10
|
return {
|
|
11
|
-
primaryColor: colors.primary,
|
|
12
|
-
secondaryColor: colors.secondary,
|
|
13
|
-
disabledColor: colors.disabled,
|
|
14
|
-
buttonOutlineWidth: button.borderWidth,
|
|
15
11
|
buttonElevation: button.elevation,
|
|
16
|
-
|
|
12
|
+
buttonOutlineWidth: button.borderWidth,
|
|
13
|
+
disabledColor: colors.disabled,
|
|
14
|
+
fontSize: fonts.fontSizes.base,
|
|
15
|
+
primaryColor: colors.primary,
|
|
16
|
+
secondaryColor: colors.secondary
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import Label from '../Label';
|
|
4
4
|
import PhotoAlbum from '../PhotoAlbum';
|
|
@@ -27,7 +27,7 @@ const Capture = ({
|
|
|
27
27
|
const isItPossibleToAddAnotherPhoto = isOnlyOnePicture ? false : images.length <= maxImages;
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
|
|
30
|
+
<>
|
|
31
31
|
{!!label && (
|
|
32
32
|
<Label semiBold big style={styles.paddingText}>
|
|
33
33
|
{label}
|
|
@@ -51,7 +51,7 @@ const Capture = ({
|
|
|
51
51
|
onError={onError}
|
|
52
52
|
/>
|
|
53
53
|
{!!helpText && <Label style={styles.paddingText}>{helpText}</Label>}
|
|
54
|
-
|
|
54
|
+
</>
|
|
55
55
|
);
|
|
56
56
|
};
|
|
57
57
|
Capture.propTypes = propTypes;
|
|
@@ -135,9 +135,11 @@ class CarouselComponent extends Component {
|
|
|
135
135
|
: { y: indexToScrollTo * (contentHeight - visibleEdge * 2 - spacing) };
|
|
136
136
|
this.ref.current.scrollTo({ ...scrollConfig, animated });
|
|
137
137
|
}
|
|
138
|
+
// eslint-disable-next-line no-console
|
|
138
139
|
} else console.warn('The index specified is not in the item list!');
|
|
139
140
|
};
|
|
140
141
|
|
|
142
|
+
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
141
143
|
scrollToDirection = (forward, animated = true) => {
|
|
142
144
|
const { currentIndex } = this.state;
|
|
143
145
|
this.scrollToIndex(currentIndex + (forward ? 1 : -1), animated, true);
|
|
@@ -7,16 +7,8 @@ import styles, { getCarouselContainerForcedStyle } from '../../styles';
|
|
|
7
7
|
import propTypes from '../../propTypes';
|
|
8
8
|
|
|
9
9
|
const CarouselContainer = ({ style, ...props }, ref) => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
contentWidth,
|
|
13
|
-
horizontal,
|
|
14
|
-
items,
|
|
15
|
-
itemStyle,
|
|
16
|
-
renderItem,
|
|
17
|
-
spacing,
|
|
18
|
-
visibleEdge
|
|
19
|
-
} = props;
|
|
10
|
+
const { contentHeight, contentWidth, horizontal, items, itemStyle, renderItem, spacing, visibleEdge } =
|
|
11
|
+
props;
|
|
20
12
|
const single = items.length === 1;
|
|
21
13
|
const itemProps = { contentHeight, contentWidth, horizontal, itemStyle, spacing, visibleEdge };
|
|
22
14
|
return (
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable react/sort-comp */
|
|
2
|
+
/* eslint-disable class-methods-use-this */
|
|
1
3
|
import React, { PureComponent } from 'react';
|
|
2
4
|
import { View, FlatList } from 'react-native';
|
|
3
5
|
import { isEmpty } from '@widergy/web-utils/lib/array';
|
|
@@ -14,6 +16,9 @@ import { keyExtractor, isChecked, areAllSelected, handleCheckAll } from './utils
|
|
|
14
16
|
import CheckBoxRenderer from './components/CheckBoxRenderer';
|
|
15
17
|
|
|
16
18
|
class CheckList extends PureComponent {
|
|
19
|
+
convertIfIsString = value =>
|
|
20
|
+
isString(value) ? (value.length === 0 ? [] : JSON.parse(value.replace(/'/g, '"'))) : value;
|
|
21
|
+
|
|
17
22
|
componentDidMount() {
|
|
18
23
|
const { input } = this.props;
|
|
19
24
|
input.onChange(this.convertIfIsString(input.value));
|
|
@@ -29,9 +34,6 @@ class CheckList extends PureComponent {
|
|
|
29
34
|
if (onChange) onChange(isEmpty(newValues) ? [] : newValues);
|
|
30
35
|
};
|
|
31
36
|
|
|
32
|
-
convertIfIsString = value =>
|
|
33
|
-
isString(value) ? (value.length === 0 ? [] : JSON.parse(value.replace(/'/g, '"'))) : value;
|
|
34
|
-
|
|
35
37
|
itemRenderer = ({ index, item }) => {
|
|
36
38
|
const {
|
|
37
39
|
labelsContainerStyle,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
2
|
-
import { bool, number, shape, oneOfType, string, arrayOf, elementType,
|
|
2
|
+
import { bool, number, shape, oneOfType, string, arrayOf, elementType, object } from 'prop-types';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
style: ViewPropTypes.style,
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
subLabel: oneOfType([number, string]),
|
|
18
18
|
required: bool,
|
|
19
19
|
disable: bool,
|
|
20
|
-
value:
|
|
20
|
+
value: oneOfType([number, string]),
|
|
21
21
|
component: elementType
|
|
22
22
|
})
|
|
23
23
|
),
|
|
@@ -17,10 +17,10 @@ export default StyleSheet.create({
|
|
|
17
17
|
containerReversed: {
|
|
18
18
|
flexDirection: 'row-reverse',
|
|
19
19
|
justifyContent: 'space-between',
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
paddingHorizontal: moderateHorizontalScale(10),
|
|
21
|
+
width: '100%'
|
|
22
22
|
},
|
|
23
23
|
icon: {
|
|
24
|
-
|
|
24
|
+
marginRight: moderateHorizontalScale(10)
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/* eslint-disable react/sort-comp */
|
|
2
|
+
/* eslint-disable class-methods-use-this */
|
|
1
3
|
// TODO implement horizontal repositioning.
|
|
2
|
-
import React, { Component, createRef
|
|
4
|
+
import React, { Component, createRef } from 'react';
|
|
3
5
|
import { Animated, ScrollView, View } from 'react-native';
|
|
4
6
|
|
|
5
7
|
import Overlay from '../Overlay';
|
|
@@ -23,6 +25,13 @@ import {
|
|
|
23
25
|
const { TransformOrigins } = TransformView;
|
|
24
26
|
|
|
25
27
|
class Dropdown extends Component {
|
|
28
|
+
measureInWindow = ref =>
|
|
29
|
+
new Promise((resolve, reject) =>
|
|
30
|
+
ref && ref.current
|
|
31
|
+
? ref.current.measureInWindow((...args) => resolve(generateLayoutMeasuresObject(...args)))
|
|
32
|
+
: reject(new Error("Ref wasn't instantiated"))
|
|
33
|
+
);
|
|
34
|
+
|
|
26
35
|
constructor(props) {
|
|
27
36
|
super(props);
|
|
28
37
|
this.state = {
|
|
@@ -57,13 +66,6 @@ class Dropdown extends Component {
|
|
|
57
66
|
clearTimeout(this.timeout);
|
|
58
67
|
}
|
|
59
68
|
|
|
60
|
-
measureInWindow = ref =>
|
|
61
|
-
new Promise((resolve, reject) =>
|
|
62
|
-
ref && ref.current
|
|
63
|
-
? ref.current.measureInWindow((...args) => resolve(generateLayoutMeasuresObject(...args)))
|
|
64
|
-
: reject(new Error("Ref wasn't instantiated"))
|
|
65
|
-
);
|
|
66
|
-
|
|
67
69
|
show = async () => {
|
|
68
70
|
const { boundary, origin } = this.props;
|
|
69
71
|
const { repositionOrigin, positioned } = this.state;
|
|
@@ -244,7 +246,7 @@ class Dropdown extends Component {
|
|
|
244
246
|
});
|
|
245
247
|
|
|
246
248
|
return (
|
|
247
|
-
|
|
249
|
+
<>
|
|
248
250
|
<View collapsable={false} ref={this.anchor}>
|
|
249
251
|
{anchor}
|
|
250
252
|
</View>
|
|
@@ -293,7 +295,7 @@ class Dropdown extends Component {
|
|
|
293
295
|
</TransformView>
|
|
294
296
|
</View>
|
|
295
297
|
</Overlay>
|
|
296
|
-
|
|
298
|
+
</>
|
|
297
299
|
);
|
|
298
300
|
}
|
|
299
301
|
}
|
|
@@ -19,11 +19,11 @@ const pageMatches = (pageSize, allowedPDFUploadSizes) =>
|
|
|
19
19
|
const blobToBase64 = blob =>
|
|
20
20
|
new Promise((resolve, reject) => {
|
|
21
21
|
const reader = new FileReader();
|
|
22
|
-
reader.onload = function() {
|
|
22
|
+
reader.onload = function () {
|
|
23
23
|
const result = reader.result.replace(/^data:.+;base64,/, '');
|
|
24
24
|
resolve(result);
|
|
25
25
|
};
|
|
26
|
-
reader.onerror = function() {
|
|
26
|
+
reader.onerror = function () {
|
|
27
27
|
reject(new Error('No es posible leer el archivo.'));
|
|
28
28
|
};
|
|
29
29
|
reader.readAsDataURL(blob);
|
|
@@ -10,6 +10,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
|
|
10
10
|
import SimpleLineIcon from 'react-native-vector-icons/SimpleLineIcons';
|
|
11
11
|
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
12
12
|
import AntIcon from 'react-native-vector-icons/AntDesign';
|
|
13
|
+
|
|
13
14
|
import VisibilityOff from './assets/eye-off.svg';
|
|
14
15
|
import Visibility from './assets/eye.svg';
|
|
15
16
|
|
|
@@ -5,7 +5,17 @@ import { getIconComponent, DEFAULT_ICON_TYPE, DEFAULT_ICON_SIZE } from './consta
|
|
|
5
5
|
|
|
6
6
|
const Icon = ({ color, height, name, size, style, type, width }) => {
|
|
7
7
|
const IconComponent = getIconComponent(type);
|
|
8
|
-
return
|
|
8
|
+
return (
|
|
9
|
+
<IconComponent
|
|
10
|
+
color={color}
|
|
11
|
+
height={height}
|
|
12
|
+
name={name}
|
|
13
|
+
size={size}
|
|
14
|
+
style={style}
|
|
15
|
+
type={type}
|
|
16
|
+
width={width}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
9
19
|
};
|
|
10
20
|
|
|
11
21
|
Icon.propTypes = propTypes;
|
|
@@ -7,7 +7,14 @@ import { DEFAULT_IMAGE_ICON_SIZE } from './constants';
|
|
|
7
7
|
|
|
8
8
|
const ImageIcon = ({ containerStyle, image, size, style, theme, withUri = false, ...props }) => {
|
|
9
9
|
const imageStyles = getImageStyles(size);
|
|
10
|
-
return
|
|
10
|
+
return (
|
|
11
|
+
<Image
|
|
12
|
+
resizeMode="contain"
|
|
13
|
+
{...props}
|
|
14
|
+
source={withUri ? { uri: image } : image}
|
|
15
|
+
style={[imageStyles, style]}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
ImageIcon.defaultProps = {
|
|
@@ -33,19 +33,27 @@ const ImageRadio = ({ options, title, onChange, value, style, variant = {} }) =>
|
|
|
33
33
|
]}
|
|
34
34
|
>
|
|
35
35
|
<View style={vertical ? styles.touchableInnerContainerVertical : styles.touchableInnerContainer}>
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
size={IMAGE_SIZE}
|
|
46
|
-
image={isSelected(option) ? option.configuration.SelectedImageComponent : option.configuration.UnselectedImageComponent}
|
|
36
|
+
{!!option.configuration.selected_image_url && (
|
|
37
|
+
<ImageIcon
|
|
38
|
+
size={IMAGE_SIZE}
|
|
39
|
+
image={
|
|
40
|
+
isSelected(option)
|
|
41
|
+
? option.configuration.selected_image_url
|
|
42
|
+
: option.configuration.image_url
|
|
43
|
+
}
|
|
44
|
+
withUri
|
|
47
45
|
/>
|
|
48
|
-
}
|
|
46
|
+
)}
|
|
47
|
+
{!!option?.configuration?.SelectedImageComponent && (
|
|
48
|
+
<ImageIcon
|
|
49
|
+
size={IMAGE_SIZE}
|
|
50
|
+
image={
|
|
51
|
+
isSelected(option)
|
|
52
|
+
? option.configuration.SelectedImageComponent
|
|
53
|
+
: option.configuration.UnselectedImageComponent
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
49
57
|
<View style={!vertical ? styles.labels : styles.verticalLabels}>
|
|
50
58
|
<Label
|
|
51
59
|
white={!transparentBackground && isSelected(option)}
|
|
@@ -85,6 +93,7 @@ ImageRadio.propTypes = {
|
|
|
85
93
|
onChange: func,
|
|
86
94
|
value: string,
|
|
87
95
|
style: ViewPropTypes.style,
|
|
96
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
88
97
|
variant: shape(any)
|
|
89
98
|
};
|
|
90
99
|
|
|
@@ -98,16 +98,8 @@ class Overlay extends Component {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
render() {
|
|
101
|
-
const {
|
|
102
|
-
|
|
103
|
-
dismissable,
|
|
104
|
-
global,
|
|
105
|
-
overlayColor,
|
|
106
|
-
style,
|
|
107
|
-
theme,
|
|
108
|
-
visible,
|
|
109
|
-
transparentBackground
|
|
110
|
-
} = this.props;
|
|
101
|
+
const { children, dismissable, global, overlayColor, style, theme, visible, transparentBackground } =
|
|
102
|
+
this.props;
|
|
111
103
|
const { opacity, backgroundOpacity } = this.state;
|
|
112
104
|
return (
|
|
113
105
|
<Portal global={global}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
// eslint-disable-next-line react-native/split-platform-components
|
|
3
3
|
import { View, TouchableOpacity, PermissionsAndroid } from 'react-native';
|
|
4
4
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -6,6 +6,7 @@ import { launchCamera } from 'react-native-image-picker';
|
|
|
6
6
|
|
|
7
7
|
import Label from '../Label';
|
|
8
8
|
import Portal from '../Portal';
|
|
9
|
+
import { IS_ANDROID } from '../../utils/platformUtils/constants';
|
|
9
10
|
|
|
10
11
|
import AddAnotherPhotoButton from './components/AddAnotherPhotoButton';
|
|
11
12
|
import DeleteView from './components/DeleteView';
|
|
@@ -35,13 +36,10 @@ const PhotoAlbum = ({
|
|
|
35
36
|
}) => {
|
|
36
37
|
const requestPermission = async () => {
|
|
37
38
|
const permissionsResponse = await PermissionsAndroid.requestMultiple([
|
|
38
|
-
PermissionsAndroid.PERMISSIONS.CAMERA
|
|
39
|
-
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
|
|
39
|
+
PermissionsAndroid.PERMISSIONS.CAMERA
|
|
40
40
|
]);
|
|
41
41
|
|
|
42
|
-
const granted =
|
|
43
|
-
permissionsResponse[PermissionsAndroid.PERMISSIONS.CAMERA] === 'granted' &&
|
|
44
|
-
permissionsResponse[PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE] === 'granted';
|
|
42
|
+
const granted = permissionsResponse[PermissionsAndroid.PERMISSIONS.CAMERA] === 'granted';
|
|
45
43
|
|
|
46
44
|
if (!granted) {
|
|
47
45
|
throw messageErrorPermissionCamera;
|
|
@@ -61,8 +59,9 @@ const PhotoAlbum = ({
|
|
|
61
59
|
};
|
|
62
60
|
|
|
63
61
|
const openCamera = async () => {
|
|
62
|
+
// eslint-disable-next-line no-useless-catch
|
|
64
63
|
try {
|
|
65
|
-
await requestPermission();
|
|
64
|
+
if (IS_ANDROID) await requestPermission();
|
|
66
65
|
|
|
67
66
|
const response = await launchCamera({});
|
|
68
67
|
const { didCancel, errorCode, errorMessage, assets } = response;
|
|
@@ -109,7 +108,7 @@ const PhotoAlbum = ({
|
|
|
109
108
|
}, [selectedImages]);
|
|
110
109
|
|
|
111
110
|
return (
|
|
112
|
-
|
|
111
|
+
<>
|
|
113
112
|
{title && (
|
|
114
113
|
<Label big semiBold color="#666666" style={styles.title}>
|
|
115
114
|
{title}
|
|
@@ -164,7 +163,7 @@ const PhotoAlbum = ({
|
|
|
164
163
|
</Portal>
|
|
165
164
|
)}
|
|
166
165
|
</View>
|
|
167
|
-
|
|
166
|
+
</>
|
|
168
167
|
);
|
|
169
168
|
};
|
|
170
169
|
|
|
@@ -24,7 +24,7 @@ const Picker = ({
|
|
|
24
24
|
markdownStyles,
|
|
25
25
|
disabled = false
|
|
26
26
|
}) => (
|
|
27
|
-
|
|
27
|
+
<>
|
|
28
28
|
{!!title && (
|
|
29
29
|
<Label
|
|
30
30
|
useMarkdown={withMarkdownTitle}
|
|
@@ -55,7 +55,7 @@ const Picker = ({
|
|
|
55
55
|
/>
|
|
56
56
|
</Touchable>
|
|
57
57
|
</View>
|
|
58
|
-
|
|
58
|
+
</>
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
Picker.propTypes = {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
/* eslint-disable react/no-unused-class-component-methods */
|
|
3
|
+
/* eslint-disable react/sort-comp */
|
|
1
4
|
import React, { PureComponent } from 'react';
|
|
2
5
|
import { StyleSheet, View } from 'react-native';
|
|
3
6
|
|
|
@@ -9,10 +12,6 @@ import { StyleSheet, View } from 'react-native';
|
|
|
9
12
|
* View https://github.com/callstack/react-native-paper/blob/master/src/components/Portal/PortalManager.tsx
|
|
10
13
|
* */
|
|
11
14
|
class Manager extends PureComponent {
|
|
12
|
-
state = {
|
|
13
|
-
portals: []
|
|
14
|
-
};
|
|
15
|
-
|
|
16
15
|
mount = (key, children) => this.setState(({ portals }) => ({ portals: [...portals, { key, children }] }));
|
|
17
16
|
|
|
18
17
|
update = (key, children) =>
|
|
@@ -25,6 +24,10 @@ class Manager extends PureComponent {
|
|
|
25
24
|
portals: [...portals].filter(portal => portal.key !== key)
|
|
26
25
|
}));
|
|
27
26
|
|
|
27
|
+
state = {
|
|
28
|
+
portals: []
|
|
29
|
+
};
|
|
30
|
+
|
|
28
31
|
renderPortal = ({ key, children }) => (
|
|
29
32
|
<View
|
|
30
33
|
key={key}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
2
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -33,7 +33,7 @@ class RadioButton extends Component {
|
|
|
33
33
|
disabled
|
|
34
34
|
} = this.props;
|
|
35
35
|
return (
|
|
36
|
-
|
|
36
|
+
<>
|
|
37
37
|
<Touchable onPress={this.handlePress} disabled={disabled}>
|
|
38
38
|
<View style={[styles.container, style]}>
|
|
39
39
|
{descriptionComponent ? (
|
|
@@ -47,7 +47,7 @@ class RadioButton extends Component {
|
|
|
47
47
|
/>
|
|
48
48
|
</View>
|
|
49
49
|
) : (
|
|
50
|
-
|
|
50
|
+
<>
|
|
51
51
|
<Icon
|
|
52
52
|
name={status ? RADIO_CHECKED_ICON : RADIO_UNCHECKED_ICON}
|
|
53
53
|
color={status ? theme.colors.primary : theme.colors.disabled}
|
|
@@ -73,12 +73,12 @@ class RadioButton extends Component {
|
|
|
73
73
|
{labelValue}
|
|
74
74
|
</Label>
|
|
75
75
|
)}
|
|
76
|
-
|
|
76
|
+
</>
|
|
77
77
|
)}
|
|
78
78
|
</View>
|
|
79
79
|
</Touchable>
|
|
80
80
|
{showSeparatorBar && <SeparatorBar />}
|
|
81
|
-
|
|
81
|
+
</>
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { number, string, arrayOf, shape, any } from 'prop-types';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
|
|
@@ -80,7 +80,7 @@ const Indicator = ({
|
|
|
80
80
|
</View>
|
|
81
81
|
|
|
82
82
|
{consumptionLimit && (
|
|
83
|
-
|
|
83
|
+
<>
|
|
84
84
|
<View
|
|
85
85
|
style={[styles.limitLabel, { left: limitTextPosition, top: -limitDimensions.height - 33 - 15 }]}
|
|
86
86
|
onLayout={handleLimitDimensions}
|
|
@@ -98,7 +98,7 @@ const Indicator = ({
|
|
|
98
98
|
</Label>
|
|
99
99
|
</View>
|
|
100
100
|
<IndicatorIcon position={limitIndicatorPosition} inverted />
|
|
101
|
-
|
|
101
|
+
</>
|
|
102
102
|
)}
|
|
103
103
|
</View>
|
|
104
104
|
);
|
|
@@ -30,7 +30,7 @@ export const getTotalRange = rateStages =>
|
|
|
30
30
|
(total, curr) =>
|
|
31
31
|
total +
|
|
32
32
|
(curr?.range[MAX_VALUE]
|
|
33
|
-
? curr?.range[MAX_VALUE] - curr.range[MIN_VALUE]
|
|
33
|
+
? (curr?.range[MAX_VALUE] || 0) - curr.range[MIN_VALUE]
|
|
34
34
|
: curr.range[MIN_VALUE] + 100 - curr.range[MIN_VALUE]),
|
|
35
35
|
0
|
|
36
36
|
);
|