@widergy/mobile-ui 1.28.2 → 1.29.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.29.0](https://github.com/widergy/mobile-ui/compare/v1.28.3...v1.29.0) (2024-10-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * [UG-2131] spacing and bottom actions updates ([#371](https://github.com/widergy/mobile-ui/issues/371)) ([93e5862](https://github.com/widergy/mobile-ui/commit/93e58629b1268cb6ccad4646e2ddb1be91de58a5))
7
+
8
+ ## [1.28.3](https://github.com/widergy/mobile-ui/compare/v1.28.2...v1.28.3) (2024-10-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * scroll ref workflow ([#373](https://github.com/widergy/mobile-ui/issues/373)) ([276e0c5](https://github.com/widergy/mobile-ui/commit/276e0c507f5af03be8b5c7e26c464b247c7a3ae1))
14
+
1
15
  ## [1.28.2](https://github.com/widergy/mobile-ui/compare/v1.28.1...v1.28.2) (2024-10-16)
2
16
 
3
17
 
@@ -0,0 +1 @@
1
+ export const DEFAULT_REDIRECTION_ICON = 'IconChevronRight';
@@ -7,6 +7,7 @@ import { ACTION_TYPES } from '../../constants';
7
7
  import { useTheme } from '../../../../theming';
8
8
  import { mergeMultipleStyles } from '../../../../utils/styleUtils';
9
9
 
10
+ import { DEFAULT_REDIRECTION_ICON } from './constants';
10
11
  import styles, { getThemeStyles } from './styles';
11
12
 
12
13
  const BottomActions = ({ actions = [], bottomActionsVariant }) => {
@@ -27,7 +28,7 @@ const BottomActions = ({ actions = [], bottomActionsVariant }) => {
27
28
  }}
28
29
  colorTheme={colorTheme}
29
30
  disabled={disabled}
30
- Icon={isRedirection ? 'IconChevronRight' : Icon}
31
+ Icon={isRedirection ? Icon || DEFAULT_REDIRECTION_ICON : Icon}
31
32
  iconPlacement={isRedirection ? 'right' : 'left'}
32
33
  loading={loading}
33
34
  onClick={onClick}
@@ -43,17 +43,19 @@ const Header = ({
43
43
 
44
44
  return (
45
45
  <View style={[styles.header, styles[size], classNames.header]}>
46
- {renderAdornment(adornment, 'left', size)}
46
+ {renderAdornment(adornment, 'left')}
47
47
  <View style={styles.headerTitles}>
48
- {renderAdornment(adornment, 'top', size)}
49
- <UTLabel variant="title3" weight="medium" {...titleProps}>
50
- {title}
51
- </UTLabel>
52
- {description && (
53
- <UTLabel colorTheme="gray" {...descriptionProps}>
54
- {description}
48
+ {renderAdornment(adornment, 'top')}
49
+ <View style={styles.titleAndDescription}>
50
+ <UTLabel variant="title3" weight="medium" {...titleProps}>
51
+ {title}
55
52
  </UTLabel>
56
- )}
53
+ {description && (
54
+ <UTLabel colorTheme="gray" {...descriptionProps}>
55
+ {description}
56
+ </UTLabel>
57
+ )}
58
+ </View>
57
59
  </View>
58
60
  {status ? (
59
61
  <Status
@@ -9,9 +9,14 @@ export default StyleSheet.create({
9
9
  headerTitles: {
10
10
  flex: 1,
11
11
  flexDirection: 'column',
12
- gap: 8,
12
+ gap: 16,
13
13
  marginRight: 'auto'
14
14
  },
15
+ titleAndDescription: {
16
+ flex: 1,
17
+ flexDirection: 'column',
18
+ gap: 8
19
+ },
15
20
  medium: {
16
21
  padding: 24
17
22
  },
@@ -26,5 +31,8 @@ export default StyleSheet.create({
26
31
  },
27
32
  alignSelf_end: {
28
33
  alignSelf: 'flex-end'
34
+ },
35
+ adornment: {
36
+ maxWidth: '100%'
29
37
  }
30
38
  });
@@ -62,19 +62,23 @@ export const statusPropsMapper = (status, theme) => {
62
62
  return { backgroundColor: theme.Palette[variant]['01'] };
63
63
  };
64
64
 
65
- export const renderAdornment = (adornment, position, size) => {
65
+ export const renderAdornment = (adornment, position) => {
66
66
  if (isEmpty(adornment) || adornment.position !== position) return null;
67
67
  const AdornmentComponent = ADORNMENT_COMPONENT_MAPPER[adornment.type];
68
68
  const defaultPlaceSelf = adornment.position === 'left' ? PLACE_SELF_TYPES.CENTER : PLACE_SELF_TYPES.START;
69
69
 
70
70
  return (
71
71
  <AdornmentComponent
72
+ {...(adornment.props || {})}
72
73
  style={[
74
+ styles.adornment,
73
75
  styles[`alignSelf_${adornment.alignment || defaultPlaceSelf}`],
74
- position === 'top' && styles[`gap_${size}`],
75
- adornment.type === 'image' && { width: adornment.props?.width, height: adornment.props?.height }
76
+ adornment.type === 'image' && {
77
+ ...(adornment.props?.width && { width: adornment.props.width }),
78
+ ...(adornment.props?.height && { height: adornment.props.height })
79
+ },
80
+ adornment.props?.style
76
81
  ]}
77
- {...(adornment.props || {})}
78
82
  />
79
83
  );
80
84
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { ScrollView, View, KeyboardAvoidingView, Keyboard } from 'react-native';
3
- import { number, func, shape, bool, string, element, oneOfType } from 'prop-types';
3
+ import { number, func, shape, bool, string, element, oneOfType, any } from 'prop-types';
4
4
  import { merge } from 'lodash';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
 
@@ -28,6 +28,7 @@ const UTWorkflowContainer = ({
28
28
  requiredFieldInfo,
29
29
  returnButton,
30
30
  scrollable = true,
31
+ scrollViewRef,
31
32
  stages,
32
33
  stepsCount,
33
34
  style,
@@ -68,6 +69,7 @@ const UTWorkflowContainer = ({
68
69
  contentContainerStyle={themedStyles.content}
69
70
  keyboardShouldPersistTaps="handled"
70
71
  scrollEnabled={scrollable}
72
+ ref={scrollViewRef}
71
73
  >
72
74
  {title && (
73
75
  <UTHeader
@@ -115,6 +117,8 @@ UTWorkflowContainer.propTypes = {
115
117
  requiredFieldInfo: string,
116
118
  returnButton: ActionButtonPropTypes,
117
119
  scrollable: bool,
120
+ // eslint-disable-next-line react/forbid-prop-types
121
+ scrollViewRef: shape({ current: any }),
118
122
  stages: StagesPropTypes,
119
123
  stepsCount: number.isRequired,
120
124
  subtitle: oneOfType([string, element]),
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.28.2",
5
+ "version": "1.29.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [