@shoutem/ui 7.1.0-beta.10 → 7.1.0-beta.12

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.
@@ -38,18 +38,28 @@ class EmptyListImage extends PureComponent {
38
38
  const EmptyStateImage = this.resolveImage();
39
39
 
40
40
  // SVG cannot receive array of style elements on Web
41
- const resolvedStyle = {
41
+ const resolvedImageStyle = {
42
42
  ...style.image,
43
43
  ...imageStyle,
44
44
  };
45
45
 
46
+ const resolvedTitleStyle = {
47
+ ...style.title,
48
+ ...titleStyle,
49
+ };
50
+
51
+ const resolvedTextStyle = {
52
+ ...style.message,
53
+ ...messageStyle,
54
+ };
55
+
46
56
  return (
47
57
  <View styleName="vertical h-center ">
48
- <EmptyStateImage style={resolvedStyle} />
49
- <Title styleName="title" style={[style.title, titleStyle]}>
58
+ <EmptyStateImage style={resolvedImageStyle} />
59
+ <Title styleName="title" style={resolvedTitleStyle}>
50
60
  {title}
51
61
  </Title>
52
- <Text styleName="description" style={[style.message, messageStyle]}>
62
+ <Text styleName="description" style={resolvedTextStyle}>
53
63
  {message}
54
64
  </Text>
55
65
  </View>
@@ -58,6 +68,7 @@ class EmptyListImage extends PureComponent {
58
68
  }
59
69
 
60
70
  EmptyListImage.propTypes = {
71
+ style: PropTypes.object.isRequired,
61
72
  image: PropTypes.func,
62
73
  imageStyle: PropTypes.object,
63
74
  message: PropTypes.string,
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { connectStyle } from '@shoutem/theme';
4
+ import { View } from '../View';
5
+ import { getIcon } from './services';
6
+
7
+ function Icon({ name, style, ...otherProps }) {
8
+ const { color, width, height, ...otherStyle } = style;
9
+
10
+ const NamedIcon = getIcon(name);
11
+
12
+ if (!NamedIcon) {
13
+ // eslint-disable-next-line no-console
14
+ console.warn(`Icon with name '${name}' not found within the provided set`);
15
+
16
+ return null;
17
+ }
18
+
19
+ return (
20
+ // Sometimes, in web, svg icons are not resized as expected, unless svg is wrapped inside View.
21
+ <View>
22
+ <NamedIcon
23
+ fill={color}
24
+ width={width}
25
+ height={height}
26
+ style={{ ...otherStyle }}
27
+ {...otherProps}
28
+ />
29
+ </View>
30
+ );
31
+ }
32
+
33
+ Icon.propTypes = {
34
+ name: PropTypes.string.isRequired,
35
+ style: PropTypes.object.isRequired,
36
+ };
37
+
38
+ export default connectStyle('shoutem.ui.Icon')(Icon);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoutem/ui",
3
- "version": "7.1.0-beta.10",
3
+ "version": "7.1.0-beta.12",
4
4
  "description": "Styleable set of components for React Native applications",
5
5
  "scripts": {
6
6
  "lint": "eslint .",