@react-native-vector-icons/common 12.0.0 → 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.
Files changed (60) hide show
  1. package/README.md +4 -4
  2. package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeVectorIconsSpec.java +42 -0
  3. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  4. package/android/generated/android/app/build/generated/source/codegen/jni/RNVectorIconsSpec-generated.cpp +38 -0
  5. package/android/generated/android/app/build/generated/source/codegen/jni/RNVectorIconsSpec.h +31 -0
  6. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.cpp +22 -0
  7. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.h +24 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/EventEmitters.cpp +16 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/EventEmitters.h +17 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/Props.cpp +19 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/Props.h +18 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/RNVectorIconsSpecJSI-generated.cpp +40 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/RNVectorIconsSpecJSI.h +76 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ShadowNodes.cpp +17 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/ShadowNodes.h +23 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/States.cpp +16 -0
  17. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNVectorIconsSpec/States.h +19 -0
  18. package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2321 -0
  19. package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +2761 -0
  20. package/ios/generated/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +2929 -0
  21. package/ios/generated/build/generated/ios/FBReactNativeSpecJSI.h +7727 -0
  22. package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.h +18 -0
  23. package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm +33 -0
  24. package/ios/generated/build/generated/ios/RNVectorIconsSpec/RNVectorIconsSpec-generated.mm +46 -0
  25. package/ios/generated/build/generated/ios/RNVectorIconsSpec/RNVectorIconsSpec.h +68 -0
  26. package/ios/generated/build/generated/ios/RNVectorIconsSpecJSI-generated.cpp +40 -0
  27. package/ios/generated/build/generated/ios/RNVectorIconsSpecJSI.h +76 -0
  28. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.cpp +22 -0
  29. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ComponentDescriptors.h +24 -0
  30. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/EventEmitters.cpp +16 -0
  31. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/EventEmitters.h +17 -0
  32. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/Props.cpp +19 -0
  33. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/Props.h +18 -0
  34. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/RCTComponentViewHelpers.h +18 -0
  35. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ShadowNodes.cpp +17 -0
  36. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/ShadowNodes.h +23 -0
  37. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/States.cpp +16 -0
  38. package/ios/generated/build/generated/ios/react/renderer/components/RNVectorIconsSpec/States.h +19 -0
  39. package/lib/commonjs/create-icon-set.js +5 -6
  40. package/lib/commonjs/create-icon-set.js.map +1 -1
  41. package/lib/commonjs/dynamicLoading/dynamic-font-loading.js +8 -18
  42. package/lib/commonjs/dynamicLoading/dynamic-font-loading.js.map +1 -1
  43. package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js +11 -1
  44. package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js.map +1 -1
  45. package/lib/module/create-icon-set.js +5 -6
  46. package/lib/module/create-icon-set.js.map +1 -1
  47. package/lib/module/dynamicLoading/dynamic-font-loading.js +9 -17
  48. package/lib/module/dynamicLoading/dynamic-font-loading.js.map +1 -1
  49. package/lib/module/dynamicLoading/dynamic-loading-setting.js +10 -1
  50. package/lib/module/dynamicLoading/dynamic-loading-setting.js.map +1 -1
  51. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts +18 -7
  53. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
  54. package/lib/typescript/module/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
  55. package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts +18 -7
  56. package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
  57. package/package.json +2 -2
  58. package/src/create-icon-set.tsx +6 -7
  59. package/src/dynamicLoading/dynamic-font-loading.ts +10 -17
  60. package/src/dynamicLoading/dynamic-loading-setting.ts +41 -13
@@ -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 = hasNecessaryExpoModules && typeof globalThis.expo?.modules.ExpoFontLoader.getLoadedFonts === 'function';
18
+ const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
9
19
  let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
10
20
  const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
11
21
 
@@ -1 +1 @@
1
- {"version":3,"names":["hasNecessaryExpoModules","globalThis","expo","modules","ExpoAsset","ExpoFontLoader","hasNecessaryExpoFeatures","getLoadedFonts","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":";;;;;;AAuBA,MAAMA,uBAAuB,GAAG,CAAC,CAACC,UAAU,CAACC,IAAI,EAAEC,OAAO,EAAEC,SAAS,IAAI,CAAC,CAACH,UAAU,CAACC,IAAI,EAAEC,OAAO,EAAEE,cAAc;AAEnH,MAAMC,wBAAwB,GAC5BN,uBAAuB,IAAI,OAAOC,UAAU,CAACC,IAAI,EAAEC,OAAO,CAACE,cAAc,CAACE,cAAc,KAAK,UAAU;AAEzG,IAAIC,yBAAyB,GAAGF,wBAAwB;AAEjD,MAAMG,yBAAyB,GAAGA,CAAA,KAAMH,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAI,OAAA,CAAAD,yBAAA,GAAAA,yBAAA;AAQO,MAAME,wBAAwB,GAAIC,KAAc,IAAc;EACnE,IAAI,CAACN,wBAAwB,EAAE;IAC7B,IAAIO,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAACH,KAAK,EAAE;MACpD,MAAMI,OAAO,GAAGhB,uBAAuB,GACnC,sGAAsG,GACtG,gIAAgI;MACpIiB,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC1B;IACA,OAAO,KAAK;EACd;EAEAR,yBAAyB,GAAG,CAAC,CAACI,KAAK;EAEnC,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAC,wBAAA,GAAAA,wBAAA;AAGO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAMX,yBAAyB;AAACE,OAAA,CAAAS,uBAAA,GAAAA,uBAAA;AAQvE,IAAIC,2BAAsD;;AAE1D;AACA;AACA;AACO,MAAMC,8BAA8B,GAAIC,QAAuB,IAAK;EACzEF,2BAA2B,GAAGE,QAAQ;AACxC,CAAC;AAACZ,OAAA,CAAAW,8BAAA,GAAAA,8BAAA;AAEK,MAAME,gBAAgB,GAAGA,CAAA,KAAMH,2BAA2B;AAACV,OAAA,CAAAa,gBAAA,GAAAA,gBAAA","ignoreList":[]}
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,KAAK,UAAU;AAE3E;AAEO,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;AAEjD,MAAME,yBAAyB,GAAGA,CAAA,KAAMF,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAG,OAAA,CAAAD,yBAAA,GAAAA,yBAAA;AAQO,MAAME,wBAAwB,GAAIC,KAAc,IAAc;EACnE,IAAI,CAACL,wBAAwB,EAAE;IAC7B,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAACH,KAAK,EAAE;MACpD,MAAMI,OAAO,GAAGX,uBAAuB,GACnC,sGAAsG,GACtG,gIAAgI;MACpIY,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC;IAC1B;IACA,OAAO,KAAK;EACd;EAEAR,yBAAyB,GAAG,CAAC,CAACI,KAAK;EAEnC,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAC,wBAAA,GAAAA,wBAAA;AAGO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAMX,yBAAyB;AAACE,OAAA,CAAAS,uBAAA,GAAAA,uBAAA;AAQvE,IAAIC,2BAAsD;;AAE1D;AACA;AACA;AACO,MAAMC,8BAA8B,GAAIC,QAAuB,IAAK;EACzEF,2BAA2B,GAAGE,QAAQ;AACxC,CAAC;AAACZ,OAAA,CAAAW,8BAAA,GAAAA,8BAAA;AAEK,MAAME,gBAAgB,GAAGA,CAAA,KAAMH,2BAA2B;AAACV,OAAA,CAAAa,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -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 || {}],
@@ -1 +1 @@
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","web","default","resolveGlyph","name","glyph","String","fromCodePoint","Icon","size","color","style","children","allowFontScaling","innerRef","props","isFontLoaded","setIsFontLoaded","useState","isLoaded","isMounted","fontSource","loadFontAsync","finally","styleDefaults","fontSize","styleOverrides","fontFamily","fontWeight","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,wBAAqB;AAAC,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAE9D,OAAO,MAAMC,iBAAiB,GAAG,EAAE;AACnC,OAAO,MAAMC,kBAAkB,GAAG,OAAO;AA8CzC,OAAO,SAASC,aAAaA,CAC3BC,QAAY,EACZC,uBAAsD,EACtDC,iBAA0B,EAC1BC,cAAmC,EAChB;EACnB,MAAM;IAAEC,cAAc;IAAEC,YAAY;IAAEC;EAAU,CAAC,GAC/C,OAAOL,uBAAuB,KAAK,QAAQ,GACvC;IAAEG,cAAc,EAAEH,uBAAuB;I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AACF,QAAQ,CAAC;IACvC;IAEA,IAAI;MACF,MAAMG,SAAS,GAAG,MAAML,aAAa,CAACc,eAAe,CACnDrD,aAAa,EACbQ,KAAK,EACLI,IAAI,EACJ4B,cAAc,CAAY;MAC5B,CAAC;MACD,MAAMM,KAAK,GAAG;QAAEC,GAAG,EAAEH,SAAS;QAAEI,KAAK,EAAExE,UAAU,CAACmE,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":[]}
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":";;A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@@ -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
- // @ts-expect-error missing types
11
- // eslint-disable-next-line import/no-extraneous-dependencies
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 expoModules = globalThis?.expo?.modules;
17
- if (!expoModules) {
18
- throw new Error('Expo is not available. Dynamic font loading is not available.');
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 resolver = resolveAssetSource;
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
- expo
72
- } = globalThis;
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","resolveAssetSource","getErrorCallback","loadPromises","loadFontAsync","fontFamily","fontSource","expoModules","globalThis","expo","modules","Error","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","ExpoFontLoader","loadAsync","error","console","fontModuleId","assetMeta","String","resolver","assetSource","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;AAErE;AACA;AACA,OAAOC,kBAAkB,MAAM,iDAAiD;AAChF,SAASC,gBAAgB,QAAQ,8BAA2B;AAG5D,MAAMC,YAAqD,GAAG,CAAC,CAAC;AAEhE,MAAMC,aAAa,GAAG,MAAAA,CAAOC,UAAkB,EAAEC,UAAsB,KAAoB;EACzF,MAAMC,WAAW,GAAGC,UAAU,EAAEC,IAAI,EAAEC,OAAO;EAC7C,IAAI,CAACH,WAAW,EAAE;IAChB,MAAM,IAAII,KAAK,CAAC,+DAA+D,CAAC;EAClF;EAEA,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,OAAOE,WAAW,CAACW,SAAS,CAACC,aAAa,CAACL,GAAG,EAAEE,IAAI,EAAED,IAAI,CAAC;MAC7D,CA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ACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAO7B,UAAU,IAAIwB,gBAAgB;AACvC,CAAC;AAED,OAAO,MAAMM,aAA4B,GAAG;EAC1CC,QAAQ,EAAEN,cAAc;EACxB1B;AACF,CAAC","ignoreList":[]}
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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C5BP,wBAAwB,CAACM,SAAS,CAAC;EAEnC,MAAMyB,iBAAiB,GAAGzB,SAAS,CAACG,IAAI,CAACC,OAAO,CAACS,cAAc,CAACa,cAAc,CAAC,CAAC;EAChFD,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,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 = hasNecessaryExpoModules && typeof globalThis.expo?.modules.ExpoFontLoader.getLoadedFonts === 'function';
13
+ const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
5
14
  let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
6
15
  export const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
7
16
 
@@ -1 +1 @@
1
- {"version":3,"names":["hasNecessaryExpoModules","globalThis","expo","modules","ExpoAsset","ExpoFontLoader","hasNecessaryExpoFeatures","getLoadedFonts","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":";;AAuBA,MAAMA,uBAAuB,GAAG,CAAC,CAACC,UAAU,CAACC,IAAI,EAAEC,OAAO,EAAEC,SAAS,IAAI,CAAC,CAACH,UAAU,CAACC,IAAI,EAAEC,OAAO,EAAEE,cAAc;AAEnH,MAAMC,wBAAwB,GAC5BN,uBAAuB,IAAI,OAAOC,UAAU,CAACC,IAAI,EAAEC,OAAO,CAACE,cAAc,CAACE,cAAc,KAAK,UAAU;AAEzG,IAAIC,yBAAyB,GAAGF,wBAAwB;AAExD,OAAO,MAAMG,yBAAyB,GAAGA,CAAA,KAAMH,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,wBAAwB,GAAIC,KAAc,IAAc;EACnE,IAAI,CAACL,wBAAwB,EAAE;IAC7B,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAACH,KAAK,EAAE;MACpD,MAAMI,OAAO,GAAGf,uBAAuB,GACnC,sGAAsG,GACtG,gIAAgI;MACpIgB,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
+ {"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 +1 @@
1
- {"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAkFzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
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
- downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
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,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,OAAO,EAAE;YACP,SAAS,EAAE;gBAGT,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;aACzF,CAAC;YACF,cAAc,EAAE;gBAGd,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;gBAC/B,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;aACxE,CAAC;SACH,CAAC;KACH;IAGD,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AASD,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
+ {"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 +1 @@
1
- {"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAkFzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
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
- downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
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,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,OAAO,EAAE;YACP,SAAS,EAAE;gBAGT,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;aACzF,CAAC;YACF,cAAc,EAAE;gBAGd,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;gBAC/B,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;aACxE,CAAC;SACH,CAAC;KACH;IAGD,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AASD,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
+ {"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-vector-icons/common",
3
- "version": "12.0.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.0"
88
+ "@react-native-vector-icons/get-image": "^12.0.1"
89
89
  },
90
90
  "peerDependenciesMeta": {
91
91
  "@react-native-vector-icons/get-image": {
@@ -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 || {}],
@@ -5,20 +5,17 @@
5
5
  // @ts-expect-error missing types
6
6
  // eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
7
7
  import { getAssetByID } from '@react-native/assets-registry/registry';
8
- import type { Image } from 'react-native';
9
- // @ts-expect-error missing types
10
- // eslint-disable-next-line import/no-extraneous-dependencies
11
- import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
12
- import { getErrorCallback } from './dynamic-loading-setting';
8
+ import { Image } from 'react-native';
9
+ import { assertExpoModulesPresent, getErrorCallback } from './dynamic-loading-setting';
13
10
  import type { DynamicLoader, FontSource } from './types';
14
11
 
15
12
  const loadPromises: { [fontSource: string]: Promise<void> } = {};
16
13
 
17
14
  const loadFontAsync = async (fontFamily: string, fontSource: FontSource): Promise<void> => {
18
- const expoModules = globalThis?.expo?.modules;
19
- if (!expoModules) {
20
- throw new Error('Expo is not available. Dynamic font loading is not available.');
21
- }
15
+ const globalRef = globalThis;
16
+ assertExpoModulesPresent(globalRef);
17
+
18
+ const expoModules = globalRef.expo.modules;
22
19
 
23
20
  if (loadPromises[fontFamily]) {
24
21
  return loadPromises[fontFamily];
@@ -66,8 +63,7 @@ const getLocalFontUrl = (fontModuleId: number, fontFamily: string) => {
66
63
  throw new Error(`no asset found for font family "${fontFamily}", moduleId: ${String(fontModuleId)}`);
67
64
  }
68
65
 
69
- const resolver: typeof Image.resolveAssetSource = resolveAssetSource;
70
- const assetSource = resolver(fontModuleId);
66
+ const assetSource = Image.resolveAssetSource(fontModuleId);
71
67
 
72
68
  return { ...assetMeta, ...assetSource };
73
69
  };
@@ -78,13 +74,10 @@ const isLoadedNative = (fontFamily: string) => {
78
74
  if (fontFamily in loadedFontsCache) {
79
75
  return true;
80
76
  }
77
+ const globalRef = globalThis;
78
+ assertExpoModulesPresent(globalRef);
81
79
 
82
- const { expo } = globalThis;
83
- if (!expo) {
84
- throw new Error('Expo is not available. Dynamic font loading is not available.');
85
- }
86
-
87
- const loadedNativeFonts = expo.modules.ExpoFontLoader.getLoadedFonts();
80
+ const loadedNativeFonts = globalRef.expo.modules.ExpoFontLoader.getLoadedFonts();
88
81
  loadedNativeFonts.forEach((font) => {
89
82
  loadedFontsCache[font] = true;
90
83
  });
@@ -1,19 +1,23 @@
1
1
  import type { FontSource } from './types';
2
2
 
3
+ type ExpoAssetModule = {
4
+ // definition from
5
+ // https://github.com/expo/expo/blob/1f5a5991d14aad09282d1ce1612b44d30e7e7d3d/packages/expo-asset/ios/AssetModule.swift#L23
6
+ downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
7
+ };
8
+
9
+ type ExpoFontLoaderModule = {
10
+ // definition from
11
+ // https://github.com/expo/expo/blob/1f5a5991d14aad09282d1ce1612b44d30e7e7d3d/packages/expo-font/ios/FontLoaderModule.swift#L18
12
+ getLoadedFonts: () => string[];
13
+ loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
14
+ };
15
+
3
16
  declare global {
4
17
  interface ExpoGlobal {
5
18
  modules: {
6
- ExpoAsset: {
7
- // definition from
8
- // https://github.com/expo/expo/blob/1f5a5991d14aad09282d1ce1612b44d30e7e7d3d/packages/expo-asset/ios/AssetModule.swift#L23
9
- downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
10
- };
11
- ExpoFontLoader: {
12
- // definition from
13
- // https://github.com/expo/expo/blob/1f5a5991d14aad09282d1ce1612b44d30e7e7d3d/packages/expo-font/ios/FontLoaderModule.swift#L18
14
- getLoadedFonts: () => string[];
15
- loadAsync: (fontFamilyAlias: string, fileUri: string) => Promise<void>;
16
- };
19
+ ExpoAsset?: ExpoAssetModule;
20
+ ExpoFontLoader?: ExpoFontLoaderModule;
17
21
  };
18
22
  }
19
23
 
@@ -21,10 +25,34 @@ declare global {
21
25
  var expo: ExpoGlobal | undefined;
22
26
  }
23
27
 
28
+ type ExpoGlobalType = {
29
+ modules: {
30
+ ExpoAsset: ExpoAssetModule;
31
+ ExpoFontLoader: ExpoFontLoaderModule;
32
+ };
33
+ };
34
+
35
+ // biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
36
+ function getIsDynamicLoadingSupported(globalObj: any): globalObj is {
37
+ expo: ExpoGlobalType;
38
+ } {
39
+ return (
40
+ globalObj?.expo &&
41
+ typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function' &&
42
+ typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' &&
43
+ typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function'
44
+ );
45
+ }
46
+
47
+ export function assertExpoModulesPresent(globalObj: unknown): asserts globalObj is { expo: ExpoGlobalType } {
48
+ if (!getIsDynamicLoadingSupported(globalObj)) {
49
+ throw new Error('Dynamic font loading for Expo is not available.');
50
+ }
51
+ }
52
+
24
53
  const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
25
54
 
26
- const hasNecessaryExpoFeatures =
27
- hasNecessaryExpoModules && typeof globalThis.expo?.modules.ExpoFontLoader.getLoadedFonts === 'function';
55
+ const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
28
56
 
29
57
  let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
30
58