@widergy/mobile-ui 1.1.0 → 1.2.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,10 @@
1
+ # [1.2.0](https://github.com/widergy/mobile-ui/compare/v1.1.0...v1.2.0) (2024-03-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * added left icon placement for button and fixed button icons ([#260](https://github.com/widergy/mobile-ui/issues/260)) ([a4bd297](https://github.com/widergy/mobile-ui/commit/a4bd297a2a49bfac3bbf7efb1af53b9506b06bf9))
7
+
1
8
  # [1.1.0](https://github.com/widergy/mobile-ui/compare/v1.0.0...v1.1.0) (2024-02-26)
2
9
 
3
10
 
@@ -4,3 +4,8 @@ export const CONTAINED_ELEVATION = 2;
4
4
  export const CONTAINED = 'contained';
5
5
  export const OUTLINED = 'outlined';
6
6
  export const TEXT = 'text';
7
+
8
+ export const ICON_PLACEMENTS = {
9
+ left: 'left',
10
+ right: 'right'
11
+ };
@@ -9,7 +9,7 @@ import { withTheme } from '../../theming';
9
9
 
10
10
  import propTypes, { buttonDefaultProps } from './propTypes';
11
11
  import styles, { getThemeStyles, getButtonModeStyles, getEffectColor } from './styles';
12
- import { NO_ELEVATION, OUTLINED, TEXT } from './constants';
12
+ import { ICON_PLACEMENTS, NO_ELEVATION, OUTLINED, TEXT } from './constants';
13
13
 
14
14
  const Button = ({
15
15
  color,
@@ -20,6 +20,7 @@ const Button = ({
20
20
  elevation,
21
21
  icon,
22
22
  iconStyle,
23
+ iconPlacement,
23
24
  labelColor,
24
25
  testID,
25
26
  labelProps,
@@ -59,7 +60,7 @@ const Button = ({
59
60
  effectColor={getEffectColor(textColor, theme, effectColor)}
60
61
  >
61
62
  <View style={[styles.button, contentStyle]}>
62
- {icon && (
63
+ {icon && iconPlacement !== ICON_PLACEMENTS.right && (
63
64
  <Icon
64
65
  color={textColor}
65
66
  name={icon.name}
@@ -75,6 +76,17 @@ const Button = ({
75
76
  {lowerCase ? title : title.toUpperCase()}
76
77
  </Label>
77
78
  )}
79
+ {icon && iconPlacement === ICON_PLACEMENTS.right && (
80
+ <Icon
81
+ color={textColor}
82
+ name={icon.name}
83
+ type={icon.type}
84
+ style={[title && styles.rightIcon, iconStyle]}
85
+ size={icon.size || themeStyles.fontSize}
86
+ width={icon.width}
87
+ height={icon.height}
88
+ />
89
+ )}
78
90
  </View>
79
91
  </Touchable>
80
92
  </Surface>
@@ -82,11 +82,14 @@ export default StyleSheet.create({
82
82
  overflow: 'hidden'
83
83
  },
84
84
  leftIcon: {
85
- paddingRight: portraitHorizontalScale(8)
85
+ marginRight: portraitHorizontalScale(8)
86
86
  },
87
87
  outerContainer: {
88
88
  alignItems: 'center'
89
89
  },
90
+ rightIcon: {
91
+ marginLeft: portraitHorizontalScale(8)
92
+ },
90
93
  touchable: {
91
94
  alignItems: 'center',
92
95
  justifyContent: 'center'
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.1.0",
5
+ "version": "1.2.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [