license import React from 'react' ; import { IconRegistryService } from './service/iconRegistry.service' ; import { IconPack } from './service/type' ; type IconsProp = IconPack < any > | IconPack < any > [ ] ; export interface IconRegistryProps { icons : IconsProp ; defaultIcons ? : string ; } export type IconRegistryElement = React . ReactElement < IconRegistryProps > ; extends React . Component property property overview-example ui-kitten export class IconRegistry extends React . Component < IconRegistryProps > { static defaultProps : Partial < IconRegistryProps > = { icons : [ ] , } ; private findDefaultIconPack = ( packs , name ) : IconPack < any > => { const requestedPackIndex = packs . findIndex ( ( pack ) : boolean => { return pack . name === name ; } ) ; return packs [ Math . max ( 0 , requestedPackIndex ) ] ; } ; private registerIcons = ( source , defaultPack ) : void => { const packs = Array . isArray ( source ) ? source : [ source ] ; const defaultIconPack = this . findDefaultIconPack ( packs , defaultPack ) ; IconRegistryService . register ( ... packs ) ; IconRegistryService . setDefaultIconPack ( defaultIconPack . name ) ; } ; public render ( ) { const { icons , defaultIcons } = this . props ; this . registerIcons ( icons , defaultIcons ) ; return null ; } }