Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native icons in one file

import React from 'react';
import Feather from 'react-native-vector-icons/Feather';
import Ionicon from 'react-native-vector-icons/Ionicons';
import ZocialIcon from 'react-native-vector-icons/Zocial';
import EntypoIcon from 'react-native-vector-icons/Entypo';
import Fontisto from 'react-native-vector-icons/Fontisto';
import EvilIcon from 'react-native-vector-icons/EvilIcons';
import FAIcon from 'react-native-vector-icons/FontAwesome';
import AntDesign from 'react-native-vector-icons/AntDesign';
import OcticonIcon from 'react-native-vector-icons/Octicons';
import FAIcon5 from 'react-native-vector-icons/FontAwesome5';
import FoundationIcon from 'react-native-vector-icons/Foundation';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import SimpleLineIcon from 'react-native-vector-icons/SimpleLineIcons';
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';

const getIcon = type => {
  switch (type) {
    case 'fontisto':
      return Fontisto;
    case 'material':
      return MaterialIcon;
    case 'evil':
      return EvilIcon;
    case 'feather':
      return Feather;
    case 'ant':
      return AntDesign;
    case 'simpleLine':
      return SimpleLineIcon;
    case 'zocial':
      return ZocialIcon;
    case 'simpleLine':
      return SimpleLineIcon;
    case 'foundation':
      return FoundationIcon;
    case 'fa5':
      return FAIcon5;
    case 'fa':
      return FAIcon;
    case 'ionicon':
      return Ionicon;
    case 'materialCommunity':
      return MaterialCommunityIcon;
    case 'entypo':
      return EntypoIcon;
    case 'octicon':
      return OcticonIcon;
    default:
      return FAIcon;
  }
};

const Icon = ({
  type,
  ...props
}) => {
  const FontIcon = getIcon(type);

  return <FontIcon { ...props
  }
  />;
};

export default Icon;
Comment

PREVIOUS NEXT
Code Example
Javascript :: example of post increment in js 
Javascript :: zgadfgad 
Javascript :: readonly checkbox angular 
Javascript :: how to send a message to email in js using window.open 
Javascript :: generate diffrent random array Numbers 
Javascript :: How to Subtract the numbers in the array, starting from the left in javascript 
Javascript :: react native star rating component 
Javascript :: dev tool console commands to stop malicious javascript 
Javascript :: nestjs forRoutes middlewarwe 
Javascript :: how to pass data to ejs partials 
Javascript :: js object percorrer 
Javascript :: sequlize where clause involving associated relationship 
Javascript :: Working with substring 
Javascript :: The console Module 
Javascript :: js sol 
Javascript :: helperbird 
Javascript :: toast width match parent 
Javascript :: selectize clickable link in item 
Javascript :: evaluate polynomial 
Javascript :: flow parsing package.json and showing error 
Javascript :: express plus es6 
Javascript :: Add a mirgation in sequelize 
Javascript :: how to call url multiple times 
Javascript :: &lt;Link&gt; react import 
Javascript :: GET_FORM-VALUE 
Javascript :: VM360:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 
Javascript :: why typescript is superset of javascript 
Javascript :: Yup validation for objects and object shape 
Javascript :: many button with many action in javascript 
Javascript :: extra reducer 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =