UNPKG

@vnaidin/react-native-cryptocurrency-icons

Version:
47 lines (46 loc) 1.87 kB
/** * Web entry point for @vnaidin/react-native-cryptocurrency-icons. * * This file is intentionally separate from the React Native entry (index.tsx) * and has NO dependency on react-native. It exports: * - `getCryptoIconUrl(symbol)` — returns a URL string suitable for <img src> * - `CryptoIcon` — a lightweight React web component (<img> with fallback avatar) * * For bundlers that support `new URL(..., import.meta.url)` (Vite, webpack 5+), * the PNG is resolved at build time and hashed into the output. * * The RN entry point (index.tsx / dist/index.js) is unaffected by this file. */ import React, { CSSProperties } from "react"; export type CryptoIconWebProps = { /** Cryptocurrency symbol, case-insensitive (e.g. "BTC", "eth"). */ symbol: string; /** Width & height in pixels. Defaults to 32. */ size?: number; /** Extra className for the root element. */ className?: string; /** Extra inline style for the root element. */ style?: CSSProperties; /** Alt text. Defaults to symbol in uppercase. */ alt?: string; }; /** * Returns a resolved URL string for the icon PNG, or `null` if the symbol * is not in the known icon set. Works with Vite / webpack 5+ via * `new URL(..., import.meta.url)`. */ export declare function getCryptoIconUrl(symbol: string): string | null; /** * Returns true if a PNG icon exists for the given symbol. */ export declare function isCryptoIconSupported(symbol: string): boolean; /** * Returns all supported symbol strings. */ export declare function getSupportedSymbols(): string[]; /** * Lightweight web `<img>` component for cryptocurrency icons. * Falls back to a colored letter-avatar when no icon is available or on error. */ export declare const CryptoIcon: React.NamedExoticComponent<CryptoIconWebProps>; export type { CryptoIconWebProps as CryptoIconProps };