UNPKG

@react-native-vector-icons/common

Version:

Customizable Icons for React Native with support for image source and full styling.

43 lines (42 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ensureGetImageAvailable = void 0; var _reactNative = require("react-native"); var _dynamicLoadingSetting = require("./dynamicLoading/dynamic-loading-setting.js"); let NativeIconAPI = null; try { NativeIconAPI = require('@react-native-vector-icons/get-image'); } catch { // if this fails, it's likely due to: // "Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'VectorIcons' could not be found. ..." // No warning at this stage. } const globalRef = globalThis; const hasExpoRenderToImage = (0, _dynamicLoadingSetting.getIsRenderToImageSupported)(globalRef); const ensureGetImageAvailable = () => { if (NativeIconAPI) { NativeIconAPI.ensureNativeModuleAvailable(); return NativeIconAPI; } if (hasExpoRenderToImage) { const { ExpoFontUtils } = globalRef.expo.modules; return { getImageForFont: async (glyph, options) => { return await ExpoFontUtils.renderToImageAsync(glyph, { ...options, color: (0, _reactNative.processColor)(options.color ?? 'black') }); }, getImageForFontSync: () => { throw new Error('You attempted to call `getImageForFontSync`. Expo dev client with `@react-native-vector-icons/get-image` installed is required for this. Alternatively, call `getImageForFont` or generate the image yourself and bundle it with the app.'); } }; } throw new Error('Error in getImageSource / getImageSourceSync: You need to either (1) install `@react-native-vector-icons/get-image` or (2) use Expo SDK 54+ (Expo dev client or Expo Go). Check your setup and rebuild the app.'); }; exports.ensureGetImageAvailable = ensureGetImageAvailable; //# sourceMappingURL=get-image-library.js.map