Managing custom icons in React Native can be challenging, especially with traditional tools like Fontello or Icomoon. These tools often lack dynamic integration with modern frameworks, making the process of adding or updating icons cumbersome and time-consuming.
Monicon offers a modern solution to these challenges, providing a flexible and efficient way to manage icons in your projects. Supporting popular frameworks like React, React Native, Next.js, Vue, Nuxt, Svelte, and more, Monicon simplifies the process of integrating custom icons. With access to over 200,000 icons from renowned libraries such as Material Design, Feather, and Font Awesome, Monicon ensures you have all the tools you need for a seamless and powerful icon management experience.
Why Use Monicon?
? Monicon Docs
? Monicon GitHub
Run the following command in your terminal to create a new Expo project:
npx create-expo-app my-new-app cd my-new-app
Run the following command to install necessary dependencies:
npm i -D @monicon/metro @monicon/babel-plugin @monicon/loader npx expo install @monicon/native react-native-svg
Create a metro.config.js file:
const { getDefaultConfig } = require("expo/metro-config"); const { withMonicon } = require("@monicon/metro"); const { loadLocalCollection } = require("@monicon/loader"); const config = getDefaultConfig(__dirname); module.exports = withMonicon(config, { customCollections: { "my-app": loadLocalCollection("assets/icons"), }, });
Create a babel.config.js file:
module.exports = function (api) { api.cache(true); return { presets: ["babel-preset-expo"], plugins: [["@monicon/babel-plugin"]], }; };
Add your custom icons to the assets/icons folder.
Example Icons
Modify the _layout.tsx file as follows:
import { Monicon } from "@monicon/native";( ), }} /> ( ), }} />
Run the following command to start your development server:
expo start
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3