1import React from 'react'; 2import { Image, ImageStyle, StyleProp } from 'react-native'; 3 4import Icons from '../constants/Icons'; 5 6export default class ExpoAPIIcon extends React.Component<{ 7 name: string; 8 style?: StyleProp<ImageStyle>; 9}> { 10 render() { 11 const { name, style } = this.props; 12 let iconKey = 'Default'; 13 if (name && Icons.hasOwnProperty(name)) { 14 iconKey = name; 15 } 16 return <Image source={Icons[iconKey]} style={[{ width: 24, height: 24 }, style]} />; 17 } 18} 19