@widergy/mobile-ui 1.4.0 → 1.4.2

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.4.2](https://github.com/widergy/mobile-ui/compare/v1.4.1...v1.4.2) (2024-04-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * native back button handler for UTTopbar ([#272](https://github.com/widergy/mobile-ui/issues/272)) ([36f8fd7](https://github.com/widergy/mobile-ui/commit/36f8fd7f467a7c0f342fc9d844452eec385e99a8))
7
+
8
+ ## [1.4.1](https://github.com/widergy/mobile-ui/compare/v1.4.0...v1.4.1) (2024-04-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * minor fixes ([#271](https://github.com/widergy/mobile-ui/issues/271)) ([4cf7246](https://github.com/widergy/mobile-ui/commit/4cf724618ced022d4dbe515bf90395875957442d))
14
+
1
15
  # [1.4.0](https://github.com/widergy/mobile-ui/compare/v1.3.4...v1.4.0) (2024-03-26)
2
16
 
3
17
 
@@ -70,8 +70,8 @@ const Checkbox = ({
70
70
  disabled
71
71
  ? disabledCheckedColor || theme.colors.disabled
72
72
  : checked
73
- ? checkedColor || theme.colors.primary
74
- : uncheckedColor || theme.colors.checkbox.unchecked
73
+ ? checkedColor || theme.colors.primary
74
+ : uncheckedColor || theme.colors.checkbox.unchecked
75
75
  }
76
76
  name={checked ? CHECKED_ICON : UNCHECKED_ICON}
77
77
  size={iconSize}
@@ -22,8 +22,8 @@ class ListView extends PureComponent {
22
22
  return isMultiple
23
23
  ? !!selectedOption?.find?.(elem => elem === item.value)
24
24
  : !query
25
- ? item.id === selectedOption
26
- : item.id === filteredOptions[0].id;
25
+ ? item.id === selectedOption
26
+ : item.id === filteredOptions[0].id;
27
27
  };
28
28
 
29
29
  handleOnPress = item => {
@@ -15,26 +15,27 @@ import ownStyles from './styles';
15
15
  import { CLOSE_ICON } from './constants';
16
16
 
17
17
  const UTModal = ({
18
- children,
19
- onRequestClose,
20
18
  acceptButton,
21
- cancelButton,
22
- visible,
23
- title,
24
- subtitle,
25
- subtitleProps = {},
26
- loading,
19
+ backgroundImg,
27
20
  backgroundStyles,
28
- imageStyles,
29
- disableTouchable,
30
- loadingText,
31
- modalBackgroundColor,
21
+ cancelButton,
22
+ children,
32
23
  color,
24
+ disableTouchable,
25
+ hideCloseButton,
26
+ hideSeparatorBar,
33
27
  imageComponent,
28
+ imageStyles,
34
29
  labelProps,
30
+ loading,
31
+ loadingText,
32
+ modalBackgroundColor,
35
33
  modalStyles,
36
- backgroundImg,
37
- hideSeparatorBar
34
+ onRequestClose,
35
+ subtitle,
36
+ subtitleProps = {},
37
+ title,
38
+ visible
38
39
  }) => {
39
40
  const theme = useTheme();
40
41
  const themeStyles = theme.simpleButton;
@@ -67,18 +68,20 @@ const UTModal = ({
67
68
  )}
68
69
  {!!imageComponent && (
69
70
  <View style={[styles.content, imageStyles]}>
70
- <Touchable
71
- borderless
72
- style={styles.closeIcon}
73
- onPress={onRequestClose || cancelButton.onPress}
74
- >
75
- <Icon name={CLOSE_ICON} color={color || 'black'} style={styles.iconSpacing} />
76
- </Touchable>
71
+ {!hideCloseButton && (
72
+ <Touchable
73
+ borderless
74
+ style={styles.closeIcon}
75
+ onPress={onRequestClose || cancelButton.onPress}
76
+ >
77
+ <Icon name={CLOSE_ICON} color={color || 'black'} style={styles.iconSpacing} />
78
+ </Touchable>
79
+ )}
77
80
  <View style={styles.imageContainer}>{imageComponent}</View>
78
81
  </View>
79
82
  )}
80
83
  <View style={styles.content}>
81
- {!backgroundImg && !imageComponent && (
84
+ {!backgroundImg && !imageComponent && !hideCloseButton && (
82
85
  <Touchable borderless style={styles.closeIcon} onPress={onRequestClose}>
83
86
  <Icon name={CLOSE_ICON} color={color || 'black'} style={styles.iconSpacing} />
84
87
  </Touchable>
@@ -6,30 +6,31 @@ import { IS_ANDROID } from '../../utils/platformUtils/constants';
6
6
 
7
7
  const buttonPropType = shape({
8
8
  backgroundColor: string,
9
- text: string,
10
- onPress: func,
11
9
  disabled: bool,
12
10
  loadingText: string,
11
+ onPress: func,
12
+ text: string,
13
13
  textColor: string
14
14
  });
15
15
 
16
16
  export default {
17
- onRequestClose: IS_ANDROID ? func.isRequired : func,
18
- cancelButton: buttonPropType,
19
17
  acceptButton: buttonPropType,
20
- visible: bool.isRequired,
21
- loading: bool,
22
- title: string,
18
+ backgroundImg: number,
19
+ backgroundStyles: ViewPropTypes.style,
20
+ cancelButton: buttonPropType,
23
21
  disableTouchable: bool,
24
- modalBackgroundColor: string,
25
- onKeyboardDismiss: func,
26
- loadingText: string,
27
22
  fill: string,
28
- imageStyles: ViewPropTypes.style,
29
- backgroundStyles: ViewPropTypes.style,
30
- modalStyles: ViewPropTypes.style,
23
+ hideCloseButton: bool,
31
24
  image: element,
32
- backgroundImg: number,
25
+ imageStyles: ViewPropTypes.style,
33
26
  labelProps: shape(bool),
34
- theme: themeType
27
+ loading: bool,
28
+ loadingText: string,
29
+ modalBackgroundColor: string,
30
+ modalStyles: ViewPropTypes.style,
31
+ onKeyboardDismiss: func,
32
+ onRequestClose: IS_ANDROID ? func.isRequired : func,
33
+ theme: themeType,
34
+ title: string,
35
+ visible: bool.isRequired
35
36
  };
@@ -91,8 +91,8 @@ const UTSwitch = ({
91
91
  thumbTrackDiference <= 0
92
92
  ? trackLength - thumbSize
93
93
  : thumbTrackDiference > thumbSize / 2
94
- ? trackLength - thumbSize * 1.5
95
- : trackLength - thumbSize * 1.2;
94
+ ? trackLength - thumbSize * 1.5
95
+ : trackLength - thumbSize * 1.2;
96
96
 
97
97
  return (
98
98
  <TouchableWithoutFeedback
@@ -9,7 +9,7 @@ import Icon from '../../../Icon';
9
9
  import Touchable from '../../../Touchable';
10
10
 
11
11
  import { DEBOUNCE_DELAY, DEBOUNCE_CONFIG, VISIBILITY, VISIBILITY_OFF } from './constants';
12
- import styles, { ICON_SIZE } from './styles';
12
+ import styles from './styles';
13
13
 
14
14
  const BaseInput = forwardRef(
15
15
  (
@@ -79,10 +79,10 @@ const OutlinedInput = ({
79
79
  borderWidth: borderless
80
80
  ? 0
81
81
  : focused
82
- ? 2
83
- : disabled
84
- ? themeStyles?.inactive?.disabledBorderWidth ?? 1
85
- : 1,
82
+ ? 2
83
+ : disabled
84
+ ? themeStyles?.inactive?.disabledBorderWidth ?? 1
85
+ : 1,
86
86
  borderColor: active ? activeColor : inactiveColor
87
87
  },
88
88
  styles?.inputContainer
@@ -1,6 +1,8 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
1
+ import React, { useCallback } from 'react';
2
+ import { BackHandler, View } from 'react-native';
3
3
  import { number } from 'prop-types';
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
5
+ import { useFocusEffect } from '@react-navigation/native';
4
6
 
5
7
  import IconButton from '../IconButton';
6
8
  import Label from '../Label';
@@ -23,6 +25,19 @@ const UTTopbar = ({
23
25
 
24
26
  const ownTheme = theme.UTWorkflowContainer?.topbar?.[colorTheme];
25
27
 
28
+ useFocusEffect(
29
+ useCallback(() => {
30
+ const onBackPress = () => {
31
+ goBack();
32
+ return true;
33
+ };
34
+
35
+ const subscription = BackHandler.addEventListener('hardwareBackPress', onBackPress);
36
+
37
+ return () => subscription.remove();
38
+ }, [goBack])
39
+ );
40
+
26
41
  return (
27
42
  <View>
28
43
  <View style={[ownStyles.container, ownTheme?.container]}>
@@ -20,6 +20,7 @@ const ActionButton = ({ hidden, disabled, onPress, label, mode, style }) => {
20
20
  lowerCase
21
21
  title={label}
22
22
  onPress={onPress}
23
+ contentStyle={themedStyles.buttonContent}
23
24
  containerStyle={themedStyles.buttonContainer}
24
25
  />
25
26
  </View>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.4.0",
5
+ "version": "1.4.2",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [
@@ -23,17 +23,18 @@
23
23
  "prepare": "husky install"
24
24
  },
25
25
  "peerDependencies": {
26
+ "@bam.tech/react-native-image-resizer": "^3.0.7",
26
27
  "prop-types": "*",
27
28
  "react": "*",
28
29
  "react-native": "*",
29
30
  "react-native-document-picker": "^9.0.1",
30
31
  "react-native-image-picker": "^5.0.0",
31
32
  "react-native-pager-view": "^6.2.0",
32
- "@bam.tech/react-native-image-resizer": "^3.0.7",
33
33
  "react-native-svg": "^13.0.0",
34
34
  "react-native-vector-icons": "^10.0.0"
35
35
  },
36
36
  "dependencies": {
37
+ "@react-navigation/native": "^6.1.9",
37
38
  "@widergy/web-utils": "^2.0.0",
38
39
  "core-js": "3",
39
40
  "deprecated-react-native-prop-types": "^4.2.1",