How to use the react-native-vector-icons/MaterialCommunityIcons.default function in react-native-vector-icons

To help you get started, we’ve selected a few react-native-vector-icons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pavjacko / renative / packages / renative / src / Icon / index.js View on Github external
import React from 'react';
import { View, Text, TouchableHighlight, TouchableOpacity } from 'react-native';

const IconMap = {
    fontAwesome: require('react-native-vector-icons/FontAwesome').default,
    feather: require('react-native-vector-icons/Feather').default,
    antDesign: require('react-native-vector-icons/AntDesign').default,
    entypo: require('react-native-vector-icons/Entypo').default,
    evilIcons: require('react-native-vector-icons/EvilIcons').default,
    foundation: require('react-native-vector-icons/Foundation').default,
    ionicons: require('react-native-vector-icons/Ionicons').default,
    materialCommunityIcons: require('react-native-vector-icons/MaterialCommunityIcons').default,
    materialIcons: require('react-native-vector-icons/MaterialIcons').default,
    octicons: require('react-native-vector-icons/Octicons').default,
    simpleLineIcons: require('react-native-vector-icons/SimpleLineIcons').default,
    zocial: require('react-native-vector-icons/Zocial').default,
};

export default class IconComponent extends React.PureComponent {
    constructor(props) {
        super(props);
    }

    render() {
        const { iconFont, iconName, iconColor, onPress, style } = this.props;
        const IC = IconMap[iconFont];
        return (
github TheToxProject / client / src / components / IconButton.js View on Github external
render() {
    const { name, title, size, color, pack, onPress } = this.props;
    const iconPack = pack ? pack : DEFAULT_ICON_PACK;

    const Icon =
      iconPack === "community"
        ? require("react-native-vector-icons/MaterialCommunityIcons").default
        : require("react-native-vector-icons/MaterialIcons").default;

    const sizeStyle = size
      ? {
          width: size * SCALE_RATIO,
          height: size * SCALE_RATIO,
          borderRadius: size * SCALE_RATIO * 2
        }
      : null;

    return (