@react-native-vector-icons/common 12.0.0-beta.1 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeVectorIconsSpec.java +42 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNVectorIconsSpec-generated.cpp +38 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNVectorIconsSpec.h +31 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.h +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/EventEmitters.cpp +16 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/EventEmitters.h +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/Props.cpp +19 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/Props.h +18 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/RNVectorIconsSpecJSI-generated.cpp +40 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/RNVectorIconsSpecJSI.h +76 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ShadowNodes.cpp +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ShadowNodes.h +23 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/States.cpp +16 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/States.h +19 -0
- package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2321 -0
- package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +2761 -0
- package/ios/generated/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +2929 -0
- package/ios/generated/build/generated/ios/FBReactNativeSpecJSI.h +7727 -0
- package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/build/generated/ios/RNVectorIconsSpec/RNVectorIconsSpec-generated.mm +46 -0
- package/ios/generated/build/generated/ios/RNVectorIconsSpec/RNVectorIconsSpec.h +68 -0
- package/ios/generated/build/generated/ios/RNVectorIconsSpecJSI-generated.cpp +40 -0
- package/ios/generated/build/generated/ios/RNVectorIconsSpecJSI.h +76 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/EventEmitters.cpp +16 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/EventEmitters.h +17 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/Props.cpp +19 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/Props.h +18 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/RCTComponentViewHelpers.h +18 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ShadowNodes.h +23 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/States.cpp +16 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/States.h +19 -0
- package/lib/commonjs/create-icon-set.js +9 -12
- package/lib/commonjs/create-icon-set.js.map +1 -1
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.js +8 -18
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.js.map +1 -1
- package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js +11 -1
- package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js.map +1 -1
- package/lib/commonjs/get-image-library.js +4 -3
- package/lib/commonjs/get-image-library.js.map +1 -1
- package/lib/module/create-icon-set.js +8 -11
- package/lib/module/create-icon-set.js.map +1 -1
- package/lib/module/dynamicLoading/dynamic-font-loading.js +9 -17
- package/lib/module/dynamicLoading/dynamic-font-loading.js.map +1 -1
- package/lib/module/dynamicLoading/dynamic-loading-setting.js +10 -1
- package/lib/module/dynamicLoading/dynamic-loading-setting.js.map +1 -1
- package/lib/module/get-image-library.js +2 -1
- package/lib/module/get-image-library.js.map +1 -1
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts +18 -7
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/get-image-library.d.ts +1 -2
- package/lib/typescript/commonjs/src/get-image-library.d.ts.map +1 -1
- package/lib/typescript/module/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
- package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts +18 -7
- package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
- package/lib/typescript/module/src/get-image-library.d.ts +1 -2
- package/lib/typescript/module/src/get-image-library.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/create-icon-set.tsx +11 -14
- package/src/dynamicLoading/dynamic-font-loading.ts +10 -17
- package/src/dynamicLoading/dynamic-loading-setting.ts +41 -13
- package/src/get-image-library.ts +3 -1
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dynamicLoader = void 0;
|
|
7
7
|
var _registry = require("@react-native/assets-registry/registry");
|
|
8
|
-
var
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
9
|
var _dynamicLoadingSetting = require("./dynamic-loading-setting.js");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
10
|
/*
|
|
12
11
|
* The following imports are always present when react native is installed
|
|
13
12
|
* in the future, more explicit apis will be exposed by the core, including typings
|
|
@@ -15,15 +14,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
15
14
|
// @ts-expect-error missing types
|
|
16
15
|
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
|
|
17
16
|
|
|
18
|
-
// @ts-expect-error missing types
|
|
19
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
20
|
-
|
|
21
17
|
const loadPromises = {};
|
|
22
18
|
const loadFontAsync = async (fontFamily, fontSource) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
19
|
+
const globalRef = globalThis;
|
|
20
|
+
(0, _dynamicLoadingSetting.assertExpoModulesPresent)(globalRef);
|
|
21
|
+
const expoModules = globalRef.expo.modules;
|
|
27
22
|
if (loadPromises[fontFamily]) {
|
|
28
23
|
return loadPromises[fontFamily];
|
|
29
24
|
}
|
|
@@ -62,8 +57,7 @@ const getLocalFontUrl = (fontModuleId, fontFamily) => {
|
|
|
62
57
|
if (!assetMeta) {
|
|
63
58
|
throw new Error(`no asset found for font family "${fontFamily}", moduleId: ${String(fontModuleId)}`);
|
|
64
59
|
}
|
|
65
|
-
const
|
|
66
|
-
const assetSource = resolver(fontModuleId);
|
|
60
|
+
const assetSource = _reactNative.Image.resolveAssetSource(fontModuleId);
|
|
67
61
|
return {
|
|
68
62
|
...assetMeta,
|
|
69
63
|
...assetSource
|
|
@@ -74,13 +68,9 @@ const isLoadedNative = fontFamily => {
|
|
|
74
68
|
if (fontFamily in loadedFontsCache) {
|
|
75
69
|
return true;
|
|
76
70
|
}
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!expo) {
|
|
81
|
-
throw new Error('Expo is not available. Dynamic font loading is not available.');
|
|
82
|
-
}
|
|
83
|
-
const loadedNativeFonts = expo.modules.ExpoFontLoader.getLoadedFonts();
|
|
71
|
+
const globalRef = globalThis;
|
|
72
|
+
(0, _dynamicLoadingSetting.assertExpoModulesPresent)(globalRef);
|
|
73
|
+
const loadedNativeFonts = globalRef.expo.modules.ExpoFontLoader.getLoadedFonts();
|
|
84
74
|
loadedNativeFonts.forEach(font => {
|
|
85
75
|
loadedFontsCache[font] = true;
|
|
86
76
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_registry","require","
|
|
1
|
+
{"version":3,"names":["_registry","require","_reactNative","_dynamicLoadingSetting","loadPromises","loadFontAsync","fontFamily","fontSource","globalRef","globalThis","assertExpoModulesPresent","expoModules","expo","modules","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","ExpoFontLoader","loadAsync","error","console","getErrorCallback","fontModuleId","assetMeta","getAssetByID","Error","String","assetSource","Image","resolveAssetSource","loadedFontsCache","isLoadedNative","loadedNativeFonts","getLoadedFonts","forEach","font","dynamicLoader","exports","isLoaded"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-font-loading.ts"],"mappings":";;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAMA,MAAMG,YAAqD,GAAG,CAAC,CAAC;AAEhE,MAAMC,aAAa,GAAG,MAAAA,CAAOC,UAAkB,EAAEC,UAAsB,KAAoB;EACzF,MAAMC,SAAS,GAAGC,UAAU;EAC5B,IAAAC,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MAAM,CAACJ,YAAY,CAAC,EAAE,CAAC;EACtG;EAEA,MAAMK,WAAW,GAAGC,kBAAK,CAACC,kBAAkB,CAACP,YAAY,CAAC;EAE1D,OAAO;IAAE,GAAGC,SAAS;IAAE,GAAGI;EAAY,CAAC;AACzC,CAAC;AAED,MAAMG,gBAA6C,GAAG,CAAC,CAAC;AAExD,MAAMC,cAAc,GAAI9B,UAAkB,IAAK;EAC7C,IAAIA,UAAU,IAAI6B,gBAAgB,EAAE;IAClC,OAAO,IAAI;EACb;EACA,MAAM3B,SAAS,GAAGC,UAAU;EAC5B,IAAAC,+CAAwB,EAACF,SAAS,CAAC;EAEnC,MAAM6B,iBAAiB,GAAG7B,SAAS,CAACI,IAAI,CAACC,OAAO,CAACS,cAAc,CAACgB,cAAc,CAAC,CAAC;EAChFD,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAOlC,UAAU,IAAI6B,gBAAgB;AACvC,CAAC;AAEM,MAAMM,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CE,QAAQ,EAAEP,cAAc;EACxB/B;AACF,CAAC","ignoreList":[]}
|
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.assertExpoModulesPresent = assertExpoModulesPresent;
|
|
6
7
|
exports.setDynamicLoadingErrorCallback = exports.setDynamicLoadingEnabled = exports.isDynamicLoadingSupported = exports.isDynamicLoadingEnabled = exports.getErrorCallback = void 0;
|
|
8
|
+
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
9
|
+
function getIsDynamicLoadingSupported(globalObj) {
|
|
10
|
+
return globalObj?.expo && typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function';
|
|
11
|
+
}
|
|
12
|
+
function assertExpoModulesPresent(globalObj) {
|
|
13
|
+
if (!getIsDynamicLoadingSupported(globalObj)) {
|
|
14
|
+
throw new Error('Dynamic font loading for Expo is not available.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
7
17
|
const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
8
|
-
const hasNecessaryExpoFeatures =
|
|
18
|
+
const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
|
|
9
19
|
let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
|
|
10
20
|
const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
|
|
11
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getIsDynamicLoadingSupported","globalObj","expo","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","assertExpoModulesPresent","Error","hasNecessaryExpoModules","globalThis","hasNecessaryExpoFeatures","dynamicFontLoadingEnabled","isDynamicLoadingSupported","exports","setDynamicLoadingEnabled","value","process","env","NODE_ENV","message","console","error","isDynamicLoadingEnabled","dynamicLoadingErrorCallback","setDynamicLoadingErrorCallback","callback","getErrorCallback"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-loading-setting.ts"],"mappings":";;;;;;;AAkCA;AACA,SAASA,4BAA4BA,CAACC,SAAc,EAElD;EACA,OACEA,SAAS,EAAEC,IAAI,IACf,OAAOD,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEC,SAAS,EAAEC,aAAa,KAAK,UAAU,IACtE,OAAOJ,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEG,cAAc,EAAEC,cAAc,KAAK,UAAU,IAC5E,OAAON,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEG,cAAc,EAAEE,SAAS,KAA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8BAAA;AAEK,MAAME,gBAAgB,GAAGA,CAAA,KAAMH,2BAA2B;AAACV,OAAA,CAAAa,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ensureGetImageAvailable =
|
|
6
|
+
exports.ensureGetImageAvailable = void 0;
|
|
7
7
|
// eslint-disable-next-line import/no-mutable-exports
|
|
8
|
-
let NativeIconAPI =
|
|
8
|
+
let NativeIconAPI = null;
|
|
9
9
|
try {
|
|
10
10
|
// eslint-disable-next-line global-require,import/no-extraneous-dependencies,@typescript-eslint/no-require-imports
|
|
11
|
-
|
|
11
|
+
NativeIconAPI = require('@react-native-vector-icons/get-image');
|
|
12
12
|
} catch {
|
|
13
13
|
// No warning at this stage
|
|
14
14
|
}
|
|
@@ -17,6 +17,7 @@ const ensureGetImageAvailable = () => {
|
|
|
17
17
|
throw new Error('Could not import @react-native-vector-icons/get-image, did you install it? It is required for getImageSource*');
|
|
18
18
|
}
|
|
19
19
|
NativeIconAPI.ensureNativeModuleAvailable();
|
|
20
|
+
return NativeIconAPI;
|
|
20
21
|
};
|
|
21
22
|
exports.ensureGetImageAvailable = ensureGetImageAvailable;
|
|
22
23
|
//# sourceMappingURL=get-image-library.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeIconAPI","
|
|
1
|
+
{"version":3,"names":["NativeIconAPI","require","ensureGetImageAvailable","Error","ensureNativeModuleAvailable","exports"],"sourceRoot":"../../src","sources":["get-image-library.ts"],"mappings":";;;;;;AAAA;AACA,IAAIA,aAA2E,GAAG,IAAI;AAEtF,IAAI;EACF;EACAA,aAAa,GAAGC,OAAO,CAAC,sCAAsC,CAAC;AACjE,CAAC,CAAC,MAAM;EACN;AAAA;AAGK,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAI,CAACF,aAAa,EAAE;IAClB,MAAM,IAAIG,KAAK,CACb,+GACF,CAAC;EACH;EAEAH,aAAa,CAACI,2BAA2B,CAAC,CAAC;EAE3C,OAAOJ,aAAa;AACtB,CAAC;AAACK,OAAA,CAAAH,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ import { PixelRatio, Platform, Text, processColor } from 'react-native';
|
|
|
8
8
|
import createIconSourceCache from "./create-icon-source-cache.js";
|
|
9
9
|
import { dynamicLoader } from './dynamicLoading/dynamic-font-loading';
|
|
10
10
|
import { isDynamicLoadingEnabled } from "./dynamicLoading/dynamic-loading-setting.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ensureGetImageAvailable } from "./get-image-library.js";
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const DEFAULT_ICON_SIZE = 12;
|
|
14
14
|
export const DEFAULT_ICON_COLOR = 'black';
|
|
@@ -26,9 +26,13 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
26
26
|
const fontReference = Platform.select({
|
|
27
27
|
windows: `/Assets/${fontFileName}#${postScriptName}`,
|
|
28
28
|
android: fontBasename,
|
|
29
|
-
web: fontBasename,
|
|
30
29
|
default: postScriptName
|
|
31
30
|
});
|
|
31
|
+
const styleOverrides = {
|
|
32
|
+
fontFamily: fontReference,
|
|
33
|
+
fontWeight: 'normal',
|
|
34
|
+
fontStyle: 'normal'
|
|
35
|
+
};
|
|
32
36
|
const resolveGlyph = name => {
|
|
33
37
|
const glyph = glyphMap[name] || '?';
|
|
34
38
|
if (typeof glyph === 'number') {
|
|
@@ -67,11 +71,6 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
67
71
|
fontSize: size,
|
|
68
72
|
color
|
|
69
73
|
};
|
|
70
|
-
const styleOverrides = {
|
|
71
|
-
fontFamily: fontReference,
|
|
72
|
-
fontWeight: 'normal',
|
|
73
|
-
fontStyle: 'normal'
|
|
74
|
-
};
|
|
75
74
|
const newProps = {
|
|
76
75
|
...props,
|
|
77
76
|
style: [styleDefaults, style, styleOverrides, fontStyle || {}],
|
|
@@ -91,7 +90,7 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
91
90
|
WrappedIcon.displayName = 'Icon';
|
|
92
91
|
const imageSourceCache = createIconSourceCache();
|
|
93
92
|
const getImageSourceSync = (name, size = DEFAULT_ICON_SIZE, color = DEFAULT_ICON_COLOR) => {
|
|
94
|
-
ensureGetImageAvailable();
|
|
93
|
+
const NativeIconAPI = ensureGetImageAvailable();
|
|
95
94
|
const glyph = resolveGlyph(name);
|
|
96
95
|
const processedColor = processColor(color);
|
|
97
96
|
const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
|
|
@@ -100,7 +99,6 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
100
99
|
return imageSourceCache.get(cacheKey);
|
|
101
100
|
}
|
|
102
101
|
try {
|
|
103
|
-
// biome-ignore lint/style/noNonNullAssertion: this is checked in ensureGetImageAvailable
|
|
104
102
|
const imagePath = NativeIconAPI.getImageForFontSync(fontReference, glyph, size, processedColor // FIXME what if a non existant colour was passed in?
|
|
105
103
|
);
|
|
106
104
|
const value = {
|
|
@@ -115,7 +113,7 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
115
113
|
}
|
|
116
114
|
};
|
|
117
115
|
const getImageSource = async (name, size = DEFAULT_ICON_SIZE, color = DEFAULT_ICON_COLOR) => {
|
|
118
|
-
ensureGetImageAvailable();
|
|
116
|
+
const NativeIconAPI = ensureGetImageAvailable();
|
|
119
117
|
const glyph = resolveGlyph(name);
|
|
120
118
|
const processedColor = processColor(color);
|
|
121
119
|
const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
|
|
@@ -124,7 +122,6 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
124
122
|
return imageSourceCache.get(cacheKey);
|
|
125
123
|
}
|
|
126
124
|
try {
|
|
127
|
-
// biome-ignore lint/style/noNonNullAssertion: this is checked in ensureGetImageAvailable
|
|
128
125
|
const imagePath = await NativeIconAPI.getImageForFont(fontReference, glyph, size, processedColor // FIXME what if a non existant colour was passed in?
|
|
129
126
|
);
|
|
130
127
|
const value = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","PixelRatio","Platform","Text","processColor","createIconSourceCache","dynamicLoader","isDynamicLoadingEnabled","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","PixelRatio","Platform","Text","processColor","createIconSourceCache","dynamicLoader","isDynamicLoadingEnabled","ensureGetImageAvailable","jsxs","_jsxs","jsx","_jsx","DEFAULT_ICON_SIZE","DEFAULT_ICON_COLOR","createIconSet","glyphMap","postScriptNameOrOptions","fontFileNameParam","fontStyleParam","postScriptName","fontFileName","fontStyle","fontBasename","replace","fontReference","select","windows","android","default","styleOverrides","fontFamily","fontWeight","resolveGlyph","name","glyph","String","fromCodePoint","Icon","size","color","style","children","allowFontScaling","innerRef","props","isFontLoaded","setIsFontLoaded","useState","isLoaded","isMounted","fontSource","loadFontAsync","finally","styleDefaults","fontSize","newProps","ref","selectable","WrappedIcon","displayName","imageSourceCache","getImageSourceSync","NativeIconAPI","processedColor","cacheKey","has","get","imagePath","getImageForFontSync","value","uri","scale","setValue","error","setError","getImageSource","getImageForFont","IconNamespace","Object","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,UAAU,EAAYC,SAAS,QAAQ,OAAO;;AAE9D;AACA,SAASC,UAAU,EAAEC,QAAQ,EAAEC,IAAI,EAAkCC,YAAY,QAAQ,cAAc;AAEvG,OAAOC,qBAAqB,MAAM,+BAA4B;AAC9D,SAASC,aAAa,QAAQ,uCAAuC;AACrE,SAASC,uBAAuB,QAAQ,6CAA0C;AAElF,SAASC,uBAAuB,QAAQ,w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Aa,GAAGvD,uBAAuB,CAAC,CAAC;IAE/C,MAAM2B,KAAK,GAAGF,YAAY,CAACC,IAAI,CAAC;IAChC,MAAM8B,cAAc,GAAG5D,YAAY,CAACoC,KAAK,CAAC;IAC1C,MAAMyB,QAAQ,GAAG,GAAG9B,KAAK,IAAII,IAAI,IAAIH,MAAM,CAAC4B,cAAc,CAAC,EAAE;IAE7D,IAAIH,gBAAgB,CAACK,GAAG,CAACD,QAAQ,CAAC,EAAE;MAClC;MACA,OAAOJ,gBAAgB,CAACM,GAAG,CAACF,QAAQ,CAAC;IACvC;IAEA,IAAI;MACF,MAAMG,SAAS,GAAG,MAAML,aAAa,CAACc,eAAe,CACnDpD,aAAa,EACbU,KAAK,EACLI,IAAI,EACJyB,cAAc,CAAY;MAC5B,CAAC;MACD,MAAMM,KAAK,GAAG;QAAEC,GAAG,EAAEH,SAAS;QAAEI,KAAK,EAAEvE,UAAU,CAACkE,GAAG,CAAC;MAAE,CAAC;MACzDN,gBAAgB,CAACY,QAAQ,CAACR,QAAQ,EAAEK,KAAK,CAAC;MAC1C,OAAOA,KAAK;IACd,CAAC,CAAC,OAAOI,KAAK,EAAE;MACdb,gBAAgB,CAACc,QAAQ,CAACV,QAAQ,EAAES,KAAc,CAAC;MACnD,MAAMA,KAAK;IACb;EACF,CAAC;EAED,MAAMI,aAAa,GAAGC,MAAM,CAACC,MAAM,CAACrB,WAAW,EAAE;IAC/CiB,cAAc;IACdd;EACF,CAAC,CAAC;EAEF,OAAOgB,aAAa;AACtB","ignoreList":[]}
|
|
@@ -7,16 +7,13 @@
|
|
|
7
7
|
// @ts-expect-error missing types
|
|
8
8
|
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
|
|
9
9
|
import { getAssetByID } from '@react-native/assets-registry/registry';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
13
|
-
import { getErrorCallback } from "./dynamic-loading-setting.js";
|
|
10
|
+
import { Image } from 'react-native';
|
|
11
|
+
import { assertExpoModulesPresent, getErrorCallback } from "./dynamic-loading-setting.js";
|
|
14
12
|
const loadPromises = {};
|
|
15
13
|
const loadFontAsync = async (fontFamily, fontSource) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
14
|
+
const globalRef = globalThis;
|
|
15
|
+
assertExpoModulesPresent(globalRef);
|
|
16
|
+
const expoModules = globalRef.expo.modules;
|
|
20
17
|
if (loadPromises[fontFamily]) {
|
|
21
18
|
return loadPromises[fontFamily];
|
|
22
19
|
}
|
|
@@ -55,8 +52,7 @@ const getLocalFontUrl = (fontModuleId, fontFamily) => {
|
|
|
55
52
|
if (!assetMeta) {
|
|
56
53
|
throw new Error(`no asset found for font family "${fontFamily}", moduleId: ${String(fontModuleId)}`);
|
|
57
54
|
}
|
|
58
|
-
const
|
|
59
|
-
const assetSource = resolver(fontModuleId);
|
|
55
|
+
const assetSource = Image.resolveAssetSource(fontModuleId);
|
|
60
56
|
return {
|
|
61
57
|
...assetMeta,
|
|
62
58
|
...assetSource
|
|
@@ -67,13 +63,9 @@ const isLoadedNative = fontFamily => {
|
|
|
67
63
|
if (fontFamily in loadedFontsCache) {
|
|
68
64
|
return true;
|
|
69
65
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (!expo) {
|
|
74
|
-
throw new Error('Expo is not available. Dynamic font loading is not available.');
|
|
75
|
-
}
|
|
76
|
-
const loadedNativeFonts = expo.modules.ExpoFontLoader.getLoadedFonts();
|
|
66
|
+
const globalRef = globalThis;
|
|
67
|
+
assertExpoModulesPresent(globalRef);
|
|
68
|
+
const loadedNativeFonts = globalRef.expo.modules.ExpoFontLoader.getLoadedFonts();
|
|
77
69
|
loadedNativeFonts.forEach(font => {
|
|
78
70
|
loadedFontsCache[font] = true;
|
|
79
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getAssetByID","
|
|
1
|
+
{"version":3,"names":["getAssetByID","Image","assertExpoModulesPresent","getErrorCallback","loadPromises","loadFontAsync","fontFamily","fontSource","globalRef","globalThis","expoModules","expo","modules","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","ExpoFontLoader","loadAsync","error","console","fontModuleId","assetMeta","Error","String","assetSource","resolveAssetSource","loadedFontsCache","isLoadedNative","loadedNativeFonts","getLoadedFonts","forEach","font","dynamicLoader","isLoaded"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-font-loading.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,wCAAwC;AACrE,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,wBAAwB,EAAEC,gBAAgB,QAAQ,8BAA2B;AAGtF,MAAMC,YAAqD,GAAG,CAAC,CAAC;AAEhE,MAAMC,aAAa,GAAG,MAAAA,CAAOC,UAAkB,EAAEC,UAAsB,KAAoB;EACzF,MAAMC,SAAS,GAAGC,UAAU;EAC5BP,wBAAwB,CAACM,SAAS,CAAC;EAEnC,MAAME,WAAW,GAAGF,SAAS,CAACG,IAAI,CAACC,OAAO;EAE1C,IAAIR,YAAY,CAACE,UAAU,CAAC,EAAE;IAC5B,OAAOF,YAAY,CAACE,UAAU,CAAC;EACjC;EAEAF,YAAY,CAACE,UAAU,CAAC,GAAI,eAAeO,QAAQA,CAAA,EAAG;IACpD,IAAI;MACF,MAAMC,QAAQ,GAAG,MAAM,CAAC,MAAM;QAC5B,IAAI,OAAOP,UAAU,KAAK,QAAQ,EAAE;UAClC;UACA,OAAOA,UAAU;QACnB;QACA;QACA,MAAM;UAAEQ,GAAG;UAAEC,IAAI;UAAEC;QAAK,CAAC,GAAGC,eAAe,CAACX,UAAU,EAAED,UAAU,CAAC;QACnE,OAAOI,WAAW,CAACS,SAAS,CAACC,aAAa,CAACL,GAAG,EAAEE,IAAI,EAAED,IAAI,CAAC;MAC7D,CAAC,EAAE,CAAC;MAEJ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,CAAC;EAEF,OAAO9B,UAAU,IAAIyB,gBAAgB;AACvC,CAAC;AAED,OAAO,MAAMM,aAA4B,GAAG;EAC1CC,QAAQ,EAAEN,cAAc;EACxB3B;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
4
|
+
function getIsDynamicLoadingSupported(globalObj) {
|
|
5
|
+
return globalObj?.expo && typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function';
|
|
6
|
+
}
|
|
7
|
+
export function assertExpoModulesPresent(globalObj) {
|
|
8
|
+
if (!getIsDynamicLoadingSupported(globalObj)) {
|
|
9
|
+
throw new Error('Dynamic font loading for Expo is not available.');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
4
|
-
const hasNecessaryExpoFeatures =
|
|
13
|
+
const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
|
|
5
14
|
let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
|
|
6
15
|
export const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
|
|
7
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getIsDynamicLoadingSupported","globalObj","expo","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","assertExpoModulesPresent","Error","hasNecessaryExpoModules","globalThis","hasNecessaryExpoFeatures","dynamicFontLoadingEnabled","isDynamicLoadingSupported","setDynamicLoadingEnabled","value","process","env","NODE_ENV","message","console","error","isDynamicLoadingEnabled","dynamicLoadingErrorCallback","setDynamicLoadingErrorCallback","callback","getErrorCallback"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-loading-setting.ts"],"mappings":";;AAkCA;AACA,SAASA,4BAA4BA,CAACC,SAAc,EAElD;EACA,OACEA,SAAS,EAAEC,IAAI,IACf,OAAOD,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEC,SAAS,EAAEC,aAAa,KAAK,UAAU,IACtE,OAAOJ,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEG,cAAc,EAAEC,cAAc,KAAK,UAAU,IAC5E,OAAON,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEG,cAAc,EAAEE,SAAS,KAAK,UAAU;AAE3E;AAEA,OAAO,SAASC,wBAAwBA,CAACR,SAAkB,EAAiD;EAC1G,IAAI,CAACD,4BAA4B,CAACC,SAAS,CAAC,EAAE;IAC5C,MAAM,IAAIS,KAAK,CAAC,iDAAiD,CAAC;EACpE;AACF;AAEA,MAAMC,uBAAuB,GAAG,CAAC,CAACC,UAAU,CAACV,IAAI,EAAEC,OAAO,EAAEC,SAAS,IAAI,CAAC,CAACQ,UAAU,CAACV,IAAI,EAAEC,OAAO,EAAEG,cAAc;AAEnH,MAAMO,wBAAwB,GAAGb,4BAA4B,CAACY,UAAU,CAAC;AAEzE,IAAIE,yBAAyB,GAAGD,wBAAwB;AAExD,OAAO,MAAME,yBAAyB,GAAGA,CAAA,KAAMF,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,wBAAwB,GAAIC,KAAc,IAAc;EACnE,IAAI,CAACJ,wBAAwB,EAAE;IAC7B,IAAIK,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAACH,KAAK,EAAE;MACpD,MAAMI,OAAO,GAAGV,uBAAuB,GACnC,sGAAsG,GACtG,gIAAgI;MACpIW,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC1B;IACA,OAAO,KAAK;EACd;EAEAP,yBAAyB,GAAG,CAAC,CAACG,KAAK;EAEnC,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMO,uBAAuB,GAAGA,CAAA,KAAMV,yBAAyB;AAQtE,IAAIW,2BAAsD;;AAE1D;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAIC,QAAuB,IAAK;EACzEF,2BAA2B,GAAGE,QAAQ;AACxC,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAMH,2BAA2B","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line import/no-mutable-exports
|
|
4
|
-
|
|
4
|
+
let NativeIconAPI = null;
|
|
5
5
|
try {
|
|
6
6
|
// eslint-disable-next-line global-require,import/no-extraneous-dependencies,@typescript-eslint/no-require-imports
|
|
7
7
|
NativeIconAPI = require('@react-native-vector-icons/get-image');
|
|
@@ -13,5 +13,6 @@ export const ensureGetImageAvailable = () => {
|
|
|
13
13
|
throw new Error('Could not import @react-native-vector-icons/get-image, did you install it? It is required for getImageSource*');
|
|
14
14
|
}
|
|
15
15
|
NativeIconAPI.ensureNativeModuleAvailable();
|
|
16
|
+
return NativeIconAPI;
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=get-image-library.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeIconAPI","require","ensureGetImageAvailable","Error","ensureNativeModuleAvailable"],"sourceRoot":"../../src","sources":["get-image-library.ts"],"mappings":";;AAAA;AACA,
|
|
1
|
+
{"version":3,"names":["NativeIconAPI","require","ensureGetImageAvailable","Error","ensureNativeModuleAvailable"],"sourceRoot":"../../src","sources":["get-image-library.ts"],"mappings":";;AAAA;AACA,IAAIA,aAA2E,GAAG,IAAI;AAEtF,IAAI;EACF;EACAA,aAAa,GAAGC,OAAO,CAAC,sCAAsC,CAAC;AACjE,CAAC,CAAC,MAAM;EACN;AAAA;AAGF,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAI,CAACF,aAAa,EAAE;IAClB,MAAM,IAAIG,KAAK,CACb,+GACF,CAAC;EACH;EAEAH,aAAa,CAACI,2BAA2B,CAAC,CAAC;EAE3C,OAAOJ,aAAa;AACtB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AA8EzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import type { FontSource } from './types';
|
|
2
|
+
type ExpoAssetModule = {
|
|
3
|
+
downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
|
|
4
|
+
};
|
|
5
|
+
type ExpoFontLoaderModule = {
|
|
6
|
+
getLoadedFonts: () => string[];
|
|
7
|
+
loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
|
|
8
|
+
};
|
|
2
9
|
declare global {
|
|
3
10
|
interface ExpoGlobal {
|
|
4
11
|
modules: {
|
|
5
|
-
ExpoAsset
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
ExpoFontLoader: {
|
|
9
|
-
getLoadedFonts: () => string[];
|
|
10
|
-
loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
|
|
11
|
-
};
|
|
12
|
+
ExpoAsset?: ExpoAssetModule;
|
|
13
|
+
ExpoFontLoader?: ExpoFontLoaderModule;
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
var expo: ExpoGlobal | undefined;
|
|
15
17
|
}
|
|
18
|
+
type ExpoGlobalType = {
|
|
19
|
+
modules: {
|
|
20
|
+
ExpoAsset: ExpoAssetModule;
|
|
21
|
+
ExpoFontLoader: ExpoFontLoaderModule;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function assertExpoModulesPresent(globalObj: unknown): asserts globalObj is {
|
|
25
|
+
expo: ExpoGlobalType;
|
|
26
|
+
};
|
|
16
27
|
export declare const isDynamicLoadingSupported: () => boolean;
|
|
17
28
|
/**
|
|
18
29
|
* Set whether dynamic loading of fonts is enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,eAAe,GAAG;IAGrB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACzF,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAG1B,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,OAAO,EAAE;YACP,SAAS,CAAC,EAAE,eAAe,CAAC;YAC5B,cAAc,CAAC,EAAE,oBAAoB,CAAC;SACvC,CAAC;KACH;IAGD,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,cAAc,EAAE,oBAAoB,CAAC;KACtC,CAAC;CACH,CAAC;AAcF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,IAAI;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAI1G;AAQD,eAAO,MAAM,yBAAyB,eAAiC,CAAC;AAExE;;;;;;;KAOK;AACL,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,OAczD,CAAC;AAEF;;KAEK;AACL,eAAO,MAAM,uBAAuB,eAAkC,CAAC;AAEvE,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACxB,KAAK,IAAI,CAAC;AAIX;;KAEK;AACL,eAAO,MAAM,8BAA8B,GAAI,UAAU,aAAa,SAErE,CAAC;AAEF,eAAO,MAAM,gBAAgB,iCAAoC,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare const ensureGetImageAvailable: () => void;
|
|
1
|
+
export declare const ensureGetImageAvailable: () => typeof import("@react-native-vector-icons/get-image");
|
|
3
2
|
//# sourceMappingURL=get-image-library.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-image-library.d.ts","sourceRoot":"","sources":["../../../../src/get-image-library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-image-library.d.ts","sourceRoot":"","sources":["../../../../src/get-image-library.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,6DAUnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AA8EzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import type { FontSource } from './types';
|
|
2
|
+
type ExpoAssetModule = {
|
|
3
|
+
downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
|
|
4
|
+
};
|
|
5
|
+
type ExpoFontLoaderModule = {
|
|
6
|
+
getLoadedFonts: () => string[];
|
|
7
|
+
loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
|
|
8
|
+
};
|
|
2
9
|
declare global {
|
|
3
10
|
interface ExpoGlobal {
|
|
4
11
|
modules: {
|
|
5
|
-
ExpoAsset
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
ExpoFontLoader: {
|
|
9
|
-
getLoadedFonts: () => string[];
|
|
10
|
-
loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
|
|
11
|
-
};
|
|
12
|
+
ExpoAsset?: ExpoAssetModule;
|
|
13
|
+
ExpoFontLoader?: ExpoFontLoaderModule;
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
var expo: ExpoGlobal | undefined;
|
|
15
17
|
}
|
|
18
|
+
type ExpoGlobalType = {
|
|
19
|
+
modules: {
|
|
20
|
+
ExpoAsset: ExpoAssetModule;
|
|
21
|
+
ExpoFontLoader: ExpoFontLoaderModule;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function assertExpoModulesPresent(globalObj: unknown): asserts globalObj is {
|
|
25
|
+
expo: ExpoGlobalType;
|
|
26
|
+
};
|
|
16
27
|
export declare const isDynamicLoadingSupported: () => boolean;
|
|
17
28
|
/**
|
|
18
29
|
* Set whether dynamic loading of fonts is enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,eAAe,GAAG;IAGrB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACzF,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAG1B,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,OAAO,EAAE;YACP,SAAS,CAAC,EAAE,eAAe,CAAC;YAC5B,cAAc,CAAC,EAAE,oBAAoB,CAAC;SACvC,CAAC;KACH;IAGD,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,cAAc,EAAE,oBAAoB,CAAC;KACtC,CAAC;CACH,CAAC;AAcF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,IAAI;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAI1G;AAQD,eAAO,MAAM,yBAAyB,eAAiC,CAAC;AAExE;;;;;;;KAOK;AACL,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,OAczD,CAAC;AAEF;;KAEK;AACL,eAAO,MAAM,uBAAuB,eAAkC,CAAC;AAEvE,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACxB,KAAK,IAAI,CAAC;AAIX;;KAEK;AACL,eAAO,MAAM,8BAA8B,GAAI,UAAU,aAAa,SAErE,CAAC;AAEF,eAAO,MAAM,gBAAgB,iCAAoC,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare const ensureGetImageAvailable: () => void;
|
|
1
|
+
export declare const ensureGetImageAvailable: () => typeof import("@react-native-vector-icons/get-image");
|
|
3
2
|
//# sourceMappingURL=get-image-library.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-image-library.d.ts","sourceRoot":"","sources":["../../../../src/get-image-library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-image-library.d.ts","sourceRoot":"","sources":["../../../../src/get-image-library.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,6DAUnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-vector-icons/common",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Customizable Icons for React Native with support for image source and full styling.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"react": "*",
|
|
87
87
|
"react-native": "*",
|
|
88
|
-
"@react-native-vector-icons/get-image": "^12.0.
|
|
88
|
+
"@react-native-vector-icons/get-image": "^12.0.1"
|
|
89
89
|
},
|
|
90
90
|
"peerDependenciesMeta": {
|
|
91
91
|
"@react-native-vector-icons/get-image": {
|
package/src/create-icon-set.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import createIconSourceCache from './create-icon-source-cache';
|
|
|
8
8
|
import { dynamicLoader } from './dynamicLoading/dynamic-font-loading';
|
|
9
9
|
import { isDynamicLoadingEnabled } from './dynamicLoading/dynamic-loading-setting';
|
|
10
10
|
import type { FontSource } from './dynamicLoading/types';
|
|
11
|
-
import {
|
|
11
|
+
import { ensureGetImageAvailable } from './get-image-library';
|
|
12
12
|
|
|
13
13
|
export const DEFAULT_ICON_SIZE = 12;
|
|
14
14
|
export const DEFAULT_ICON_COLOR = 'black';
|
|
@@ -73,10 +73,15 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
73
73
|
const fontReference = Platform.select({
|
|
74
74
|
windows: `/Assets/${fontFileName}#${postScriptName}`,
|
|
75
75
|
android: fontBasename,
|
|
76
|
-
web: fontBasename,
|
|
77
76
|
default: postScriptName,
|
|
78
77
|
});
|
|
79
78
|
|
|
79
|
+
const styleOverrides: TextProps['style'] = {
|
|
80
|
+
fontFamily: fontReference,
|
|
81
|
+
fontWeight: 'normal',
|
|
82
|
+
fontStyle: 'normal',
|
|
83
|
+
};
|
|
84
|
+
|
|
80
85
|
const resolveGlyph = (name: keyof GM) => {
|
|
81
86
|
const glyph = glyphMap[name] || '?';
|
|
82
87
|
|
|
@@ -127,12 +132,6 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
127
132
|
color,
|
|
128
133
|
};
|
|
129
134
|
|
|
130
|
-
const styleOverrides: TextProps['style'] = {
|
|
131
|
-
fontFamily: fontReference,
|
|
132
|
-
fontWeight: 'normal',
|
|
133
|
-
fontStyle: 'normal',
|
|
134
|
-
};
|
|
135
|
-
|
|
136
135
|
const newProps: TextProps = {
|
|
137
136
|
...props,
|
|
138
137
|
style: [styleDefaults, style, styleOverrides, fontStyle || {}],
|
|
@@ -159,7 +158,7 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
159
158
|
size = DEFAULT_ICON_SIZE,
|
|
160
159
|
color: TextStyle['color'] = DEFAULT_ICON_COLOR,
|
|
161
160
|
) => {
|
|
162
|
-
ensureGetImageAvailable();
|
|
161
|
+
const NativeIconAPI = ensureGetImageAvailable();
|
|
163
162
|
|
|
164
163
|
const glyph = resolveGlyph(name);
|
|
165
164
|
const processedColor = processColor(color);
|
|
@@ -171,8 +170,7 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
try {
|
|
174
|
-
|
|
175
|
-
const imagePath = NativeIconAPI!.getImageForFontSync(
|
|
173
|
+
const imagePath = NativeIconAPI.getImageForFontSync(
|
|
176
174
|
fontReference,
|
|
177
175
|
glyph,
|
|
178
176
|
size,
|
|
@@ -192,7 +190,7 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
192
190
|
size = DEFAULT_ICON_SIZE,
|
|
193
191
|
color: TextStyle['color'] = DEFAULT_ICON_COLOR,
|
|
194
192
|
) => {
|
|
195
|
-
ensureGetImageAvailable();
|
|
193
|
+
const NativeIconAPI = ensureGetImageAvailable();
|
|
196
194
|
|
|
197
195
|
const glyph = resolveGlyph(name);
|
|
198
196
|
const processedColor = processColor(color);
|
|
@@ -204,8 +202,7 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
204
202
|
}
|
|
205
203
|
|
|
206
204
|
try {
|
|
207
|
-
|
|
208
|
-
const imagePath = await NativeIconAPI!.getImageForFont(
|
|
205
|
+
const imagePath = await NativeIconAPI.getImageForFont(
|
|
209
206
|
fontReference,
|
|
210
207
|
glyph,
|
|
211
208
|
size,
|