import * as React from 'react' ; import { Animated , ViewProps , } from 'react-native' ; import { SvgIcon , SvgIconProps , } from './svgIcon.component' ; import { AnimationConfig , getIconAnimation , IconAnimation , IconAnimationRegistry , } from './animation' ; export interface IconProps extends SvgIconProps { animation ? : keyof IconAnimationRegistry ; animationConfig ? : AnimationConfig ; } property property property method method method export class Icon extends React . Component < IconProps > { static defaultProps : Partial < IconProps > = { animation : 'zoom' } ; private readonly animation : IconAnimation ; constructor ( props ) { super ( props ) ; this . animation = getIconAnimation ( props . animation , props . animationConfig ) ; } public componentWillUnmount ( ) { this . animation . release ( ) ; } param callback { Animated . EndCallback } public startAnimation = ( callback ? ) : void => { this . animation . start ( callback ) ; } ; /**
     * Stops the animation
     */ public stopAnimation = ( ) : void => { this . animation . stop ( ) ; } ; returns public isAnimating = ( ) : boolean => { return this . animation . isAnimating ( ) ; } ; public render ( ) { const { animation , animationConfig , ... svgIconProps } = this . props ; return ( < Animated . View { ... this . animation . toProps ( ) } > < SvgIcon { ... svgIconProps } / > < /Animated.View>); } }