UNPKG

@platformbuilders/react-native-ui

Version:
17 lines 1.53 kB
import { __rest } from "tslib"; import React from 'react'; import { Animated, View } from 'react-native'; import MaterialIcons from 'react-native-vector-icons/MaterialCommunityIcons'; import Touchable from '../Touchable'; import * as Icons from '../../assets/svg'; export const Icon = (_a) => { var { id, accessibility, accessibilityLabel, testID, name = '', touchable = true, size = 20, color = undefined, style = [{}], onPress = () => { }, borderColor = '', backgroundColor = '' } = _a, rest = __rest(_a, ["id", "accessibility", "accessibilityLabel", "testID", "name", "touchable", "size", "color", "style", "onPress", "borderColor", "backgroundColor"]); // eslint-disable-next-line prettier/prettier const iconName = (name === null || name === void 0 ? void 0 : name.charAt(0).toUpperCase()) + (name === null || name === void 0 ? void 0 : name.slice(1)); const Svg = Icons[`Icon${iconName}`]; return (React.createElement(Animated.View, { style: style }, React.createElement(Touchable, Object.assign({ id: id, accessibility: accessibility || iconName, accessibilityLabel: accessibilityLabel || accessibility, testID: testID || id, disabled: !touchable, onPress: onPress }, rest), React.createElement(View, null, Svg ? (React.createElement(Svg, { width: size, height: size, color: color, borderColor: borderColor, backgroundColor: backgroundColor })) : (React.createElement(MaterialIcons, { name: name, color: color, size: size })))))); }; export default Icon; //# sourceMappingURL=index.js.map