1import MaterialCommunityIcons from '@expo/vector-icons/build/MaterialCommunityIcons'; 2import React from 'react'; 3import { Platform } from 'react-native'; 4 5import { Colors } from '../constants'; 6 7interface Props { 8 name: string; 9 focused?: boolean; 10 size?: number; 11} 12 13export default class TabIcon extends React.PureComponent<Props> { 14 render() { 15 const { size = 27, name, focused } = this.props; 16 const color = focused ? Colors.tabIconSelected : Colors.tabIconDefault; 17 18 const platformSize = Platform.select({ 19 ios: size, 20 default: size - 2, 21 }); 22 return <MaterialCommunityIcons name={name as any} size={platformSize} color={color} />; 23 } 24} 25