/**
 * ✔ type
 * ✔ size
 * ✔ color
 */ import * as React from 'react' ; import { View , Image } from 'react-native' ; import * as WEUI from '../../assets/weui' ; import { IconProps } from './PropsType' ; interface UIType { [ key ] : any ; } const iconTypeMap = { success : 'SUCCESS' , success_no_circle : 'SUCCESS_NO_CIRCLE' , info : 'INFO' , warn : 'WARN' , waiting : 'WAITING' , cancel : 'CANCEL' , download : 'DOWNLOAD' , search : 'SEARCH' , clear : 'CLEAR' , } ; const _Icon = ( { style , type , size = 23 , color } ) => { size = ~ ~ size ; const iconObj = ( WEUI as UIType ) [ iconTypeMap [ type ] ] ; if ( ! iconObj ) { return ( < View style = { [ style , { width : size , height : size } ] } / > ) ; } const imageAsset = iconObj . image ; const iconColor = color || iconObj . defaultColor ; return ( < View style = { [ style , { width : size , height : size } ] } > < Image source = { imageAsset } style = { { width : size , height : size , tintColor : iconColor } } /> < /View>); } ; _Icon . displayName = '_Icon' ; export default _Icon ;