@shoutem/ui 7.1.0-beta.11 → 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.
@@ -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.11",
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 .",