Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to correctly import custom icon in Expo with Typescript

$
0
0

I have an AppIcon like this:

import { createIconSetFromIcoMoon } from "@expo/vector-icons";import icoMoonSelection from "../assets/fonts/selection.json";export const AppIcon = createIconSetFromIcoMoon(icoMoonSelection, "icomoon", "icomoon.ttf");

When I use this in other screens or components, with an import like below, I get the following Typescript error. The error goes away if I do const AppIcon = require("../components/AppIcon"). What is the right way of importing the component?

import { AppIcon } from "../components/AppIcon";

'AppIcon' cannot be used as a JSX component.Its instance type 'Component<IconProps, {}, any>' is not a valid JSX element.ts(2786)


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>