@react-native-vector-icons/common 12.1.0 → 12.3.0
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 +17 -15
- package/lib/commonjs/create-icon-set.js +2 -2
- package/lib/commonjs/create-icon-set.js.map +1 -1
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.js +9 -1
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.js.map +1 -1
- package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js +7 -4
- package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js.map +1 -1
- package/lib/commonjs/scripts/common.js +12 -2
- package/lib/commonjs/scripts/common.js.map +1 -1
- package/lib/module/create-icon-set.js +2 -2
- package/lib/module/create-icon-set.js.map +1 -1
- package/lib/module/dynamicLoading/dynamic-font-loading.js +10 -3
- package/lib/module/dynamicLoading/dynamic-font-loading.js.map +1 -1
- package/lib/module/dynamicLoading/dynamic-loading-setting.js +8 -4
- package/lib/module/dynamicLoading/dynamic-loading-setting.js.map +1 -1
- package/lib/module/scripts/common.js +12 -1
- package/lib/module/scripts/common.js.map +1 -1
- package/lib/typescript/commonjs/src/create-icon-set.d.ts +1 -1
- package/lib/typescript/commonjs/src/create-icon-set.d.ts.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 +5 -1
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/scripts/common.d.ts.map +1 -1
- package/lib/typescript/module/src/create-icon-set.d.ts +1 -1
- package/lib/typescript/module/src/create-icon-set.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 +5 -1
- package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/scripts/common.d.ts.map +1 -1
- package/package.json +13 -4
- package/src/create-icon-set.tsx +2 -2
- package/src/dynamicLoading/dynamic-font-loading.ts +8 -4
- package/src/dynamicLoading/dynamic-loading-setting.ts +12 -6
- package/src/index.ts +1 -1
- package/src/scripts/common.ts +13 -1
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.web.js +0 -20
- package/lib/commonjs/dynamicLoading/dynamic-font-loading.web.js.map +0 -1
- package/lib/module/dynamicLoading/dynamic-font-loading.web.js +0 -16
- package/lib/module/dynamicLoading/dynamic-font-loading.web.js.map +0 -1
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-font-loading.web.d.ts +0 -6
- package/lib/typescript/commonjs/src/dynamicLoading/dynamic-font-loading.web.d.ts.map +0 -1
- package/lib/typescript/module/src/dynamicLoading/dynamic-font-loading.web.d.ts +0 -6
- package/lib/typescript/module/src/dynamicLoading/dynamic-font-loading.web.d.ts.map +0 -1
- package/src/dynamicLoading/dynamic-font-loading.web.ts +0 -15
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ extension and styling effortless.
|
|
|
12
12
|
For the integration of `.svg` files natively, you can explore [`react-native-vector-image`](https://github.com/oblador/react-native-vector-image).
|
|
13
13
|
|
|
14
14
|
> [!TIP]
|
|
15
|
-
> If you are still using the old single package `react-native-vector-icons`
|
|
15
|
+
> If you are still using the old single package `react-native-vector-icons` visit <https://github.com/oblador/react-native-vector-icons/tree/10.x>. To migrate to the package-per-icon-set approach, see [MIGRATION.md](MIGRATION.md).
|
|
16
16
|
|
|
17
17
|
## Table of Contents
|
|
18
18
|
|
|
@@ -87,7 +87,7 @@ See [MIGRATION.md](MIGRATION.md) if you are migrating from `react-native-vector-
|
|
|
87
87
|
|
|
88
88
|
## Setup
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
Refer to the guide for [Expo](./docs/SETUP-EXPO.md), [React Native](./docs/SETUP-REACT-NATIVE.md) or [Web](./docs/SETUP-WEB.md) for further instructions.
|
|
91
91
|
|
|
92
92
|
### Font location customisation
|
|
93
93
|
|
|
@@ -106,9 +106,9 @@ For fonts like fontawesome6-pro, fontello and icomoon where you provide the font
|
|
|
106
106
|
You can either use one of the bundled icons above or roll your own custom font.
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
|
-
import
|
|
109
|
+
import { FontAwesome } from "@react-native-vector-icons/fontawesome";
|
|
110
110
|
|
|
111
|
-
<
|
|
111
|
+
<FontAwesome name="rocket" size={30} color="#900" />;
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
### Props
|
|
@@ -144,13 +144,13 @@ By combining some of these you can create for example :
|
|
|
144
144
|
Some fonts today use multiple styles, FontAwesome 6 for example, which is supported by this library. The usage is pretty much the same as the standard `Icon` component:
|
|
145
145
|
|
|
146
146
|
```jsx
|
|
147
|
-
import
|
|
147
|
+
import { FontAwesome5 } from "@react-native-vector-icons/fontawesome5";
|
|
148
148
|
|
|
149
|
-
<
|
|
149
|
+
<FontAwesome5 name="comments" size={30} color="#900" />; // Defaults to regular
|
|
150
150
|
|
|
151
|
-
<
|
|
151
|
+
<FontAwesome5 name="comments" size={30} color="#900" iconType="solid" />
|
|
152
152
|
|
|
153
|
-
<
|
|
153
|
+
<FontAwesome5 name="comments" size={30} color="#900" iconType="light" />
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
## Usage as PNG Image/Source Object
|
|
@@ -187,7 +187,7 @@ See [CREATE_FONT_PACKAGE.md](./docs/CREATE_FONT_PACKAGE.md) to learn how to crea
|
|
|
187
187
|
|
|
188
188
|
You can also use `createIconSet()` directly in your project. This
|
|
189
189
|
returns your own custom font based on the `glyphMap` where the key is the icon
|
|
190
|
-
name and the value is either a UTF-8 character or
|
|
190
|
+
name and the value is either a UTF-8 character or its character code.
|
|
191
191
|
`postScriptName` is the name of the postscript font. Open the font in <https://fontdrop.info/>,
|
|
192
192
|
Font Book.app or similar to learn the name. Also pass the `fontFileName` argument for Android support.
|
|
193
193
|
|
|
@@ -217,11 +217,11 @@ animation library
|
|
|
217
217
|
|
|
218
218
|
## Dynamic icon font loading
|
|
219
219
|
|
|
220
|
-
>
|
|
220
|
+
> Dynamic loading is supported on all platforms if you use Expo ([Expo Go](https://expo.dev/go) or a development client). In the future, it should become available for all React Native projects via React Native core.
|
|
221
221
|
|
|
222
222
|
Fonts can be available in an app statically (since build time) or loaded dynamically at runtime. The latter can be useful e.g. for apps that use over-the-air updates and want to load new fonts with an update, or when you need to use a font from a remote location.
|
|
223
223
|
|
|
224
|
-
Dynamic loading in react-native-vector-icons is currently limited to those fonts that are bundled within the provided packages: it doesn't support Pro fonts (such as FontAwesome 5 Pro). However, loading of custom fonts is not difficult to implement:
|
|
224
|
+
Dynamic loading in `@react-native-vector-icons` is currently limited to those fonts that are bundled within the provided packages: it doesn't support Pro fonts (such as FontAwesome 5 Pro). However, loading of custom fonts is not difficult to implement: use `createIconSet` as seen in [custom fonts](#custom-fonts) paragraph to obtain a icon font family with dynamic font loading enabled. See any of the free font packages for reference.
|
|
225
225
|
|
|
226
226
|
By default, dynamic loading is enabled if you run Expo SDK >= 52. It doesn't change the way you work with the package: If rendering an icon requires a font that is not known to the app, it will be loaded automatically and icon will render as expected.
|
|
227
227
|
|
|
@@ -243,20 +243,22 @@ Try the `IconExplorer` project in `Examples/IconExplorer` folder, there you can
|
|
|
243
243
|
### Basic Example
|
|
244
244
|
|
|
245
245
|
```js
|
|
246
|
-
import
|
|
246
|
+
import { IonIcons } from "@react-native-vector-icons/ionicons";
|
|
247
247
|
|
|
248
|
-
const ExampleView = () =>
|
|
248
|
+
const ExampleView = () => (
|
|
249
|
+
<IonIcon name="ios-person" size={30} color="#4F8EF7" />
|
|
250
|
+
);
|
|
249
251
|
```
|
|
250
252
|
|
|
251
253
|
### Inline Icons
|
|
252
254
|
|
|
253
255
|
```js
|
|
254
256
|
import { Text } from "react-native";
|
|
255
|
-
import
|
|
257
|
+
import { IonIcons } from "@react-native-vector-icons/ionicons";
|
|
256
258
|
|
|
257
259
|
const ExampleView = (props) => (
|
|
258
260
|
<Text>
|
|
259
|
-
Lorem <
|
|
261
|
+
Lorem <IonIcon name="ios-book" color="#4F8EF7" /> Ipsum
|
|
260
262
|
</Text>
|
|
261
263
|
);
|
|
262
264
|
```
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _createIconSourceCache = _interopRequireDefault(require("./create-icon-source-cache.js"));
|
|
10
10
|
var _defaults = require("./defaults.js");
|
|
11
|
-
var _dynamicFontLoading = require("./dynamicLoading/dynamic-font-loading");
|
|
11
|
+
var _dynamicFontLoading = require("./dynamicLoading/dynamic-font-loading.js");
|
|
12
12
|
var _dynamicLoadingSetting = require("./dynamicLoading/dynamic-loading-setting.js");
|
|
13
13
|
var _getImageSource = require("./get-image-source.js");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -94,7 +94,7 @@ function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNameParam, fon
|
|
|
94
94
|
innerRef: ref,
|
|
95
95
|
...props
|
|
96
96
|
}));
|
|
97
|
-
WrappedIcon.displayName =
|
|
97
|
+
WrappedIcon.displayName = `Icon(${postScriptName})`;
|
|
98
98
|
const imageSourceCache = (0, _createIconSourceCache.default)();
|
|
99
99
|
const getImageSource = async (name, size, color) => {
|
|
100
100
|
if (typeof postScriptNameOrOptions === 'object' && typeof postScriptNameOrOptions.fontSource !== 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createIconSourceCache","_interopRequireDefault","_defaults","_dynamicFontLoading","_dynamicLoadingSetting","_getImageSource","_jsxRuntime","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createIconSet","glyphMap","postScriptNameOrOptions","fontFileNameParam","fontStyleParam","postScriptName","fontFileName","fontStyle","fontBasename","replace","fontReference","Platform","select","windows","android","styleOverrides","fontFamily","fontWeight","resolveGlyph","name","glyph","String","fromCodePoint","Icon","size","DEFAULT_ICON_SIZE","color","DEFAULT_ICON_COLOR","style","children","allowFontScaling","innerRef","props","isFontLoaded","setIsFontLoaded","React","useState","isDynamicLoadingEnabled","dynamicLoader","isLoaded","useEffect","isMounted","fontSource","loadFontAsync","finally","styleDefaults","fontSize","newProps","jsxs","Text","ref","selectable","WrappedIcon","forwardRef","jsx","displayName","imageSourceCache","createIconSourceCache","getImageSource","getImageSourceImpl","getImageSourceSync","getImageSourceSyncImpl","IconNamespace","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AAAwH,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAG,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAA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O,CAAC,MAAM;UAC3F,IAAIH,SAAS,EAAE;YACbP,eAAe,CAAC,IAAI,CAAC;UACvB;QACF,CAAC,CAAC;MACJ;MACA,OAAO,MAAM;QACXO,SAAS,GAAG,KAAK;MACnB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMI,aAAa,GAAG;MACpBC,QAAQ,EAAEtB,IAAI;MACdE;IACF,CAAC;IAED,MAAMqB,QAAmB,GAAG;MAC1B,GAAGf,KAAK;MACRJ,KAAK,EAAE,CAACiB,aAAa,EAAEjB,KAAK,EAAEb,cAAc,EAAER,SAAS,IAAI,CAAC,CAAC,CAAC;MAC9DuB;IACF,CAAC;IAED,oBACE,IAAAnD,WAAA,CAAAqE,IAAA,EAAC5E,YAAA,CAAA6E,IAAI;MAACC,GAAG,EAAEnB,QAAS;MAACoB,UAAU,EAAE,KAAM;MAAA,GAAKJ,QAAQ;MAAAlB,QAAA,GACjDT,KAAK,EACLS,QAAQ;IAAA,CACL,CAAC;EAEX,CAAC;EAED,MAAMuB,WAAW,gBAAG,IAAAC,iBAAU,EAAyC,CAACrB,KAAK,EAAEkB,GAAG,kBAChF,IAAAvE,WAAA,CAAA2E,GAAA,EAAC/B,IAAI;IAACQ,QAAQ,EAAEmB,GAAI;IAAA,GAAKlB;EAAK,CAAG,CAClC,CAAC;EACFoB,WAAW,CAACG,WAAW,GAAG,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createIconSourceCache","_interopRequireDefault","_defaults","_dynamicFontLoading","_dynamicLoadingSetting","_getImageSource","_jsxRuntime","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createIconSet","glyphMap","postScriptNameOrOptions","fontFileNameParam","fontStyleParam","postScriptName","fontFileName","fontStyle","fontBasename","replace","fontReference","Platform","select","windows","android","styleOverrides","fontFamily","fontWeight","resolveGlyph","name","glyph","String","fromCodePoint","Icon","size","DEFAULT_ICON_SIZE","color","DEFAULT_ICON_COLOR","style","children","allowFontScaling","innerRef","props","isFontLoaded","setIsFontLoaded","React","useState","isDynamicLoadingEnabled","dynamicLoader","isLoaded","useEffect","isMounted","fontSource","loadFontAsync","finally","styleDefaults","fontSize","newProps","jsxs","Text","ref","selectable","WrappedIcon","forwardRef","jsx","displayName","imageSourceCache","createIconSourceCache","getImageSource","getImageSourceImpl","getImageSourceSync","getImageSourceSyncImpl","IconNamespace","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAP,OAAA;AAAwH,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAG,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,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,CAACC,IAAI,CAAC,EAAEK,IAAI,EAAEE,KAAK,CAAC;EAE1F,MAAMoC,aAAa,GAAGtE,MAAM,CAACuE,MAAM,CAACX,WAAW,EAAE;IAC/CM,cAAc;IACdE;EACF,CAAC,CAAC;EAEF,OAAOE,aAAa;AACtB","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ var _dynamicLoadingSetting = require("./dynamic-loading-setting.js");
|
|
|
11
11
|
* The following imports are always present when react native is installed
|
|
12
12
|
* in the future, more explicit apis will be exposed by the core, including typings
|
|
13
13
|
* */
|
|
14
|
+
|
|
14
15
|
// @ts-expect-error missing types
|
|
15
16
|
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
|
|
16
17
|
|
|
@@ -37,7 +38,14 @@ const loadFontAsync = async (fontFamily, fontSource) => {
|
|
|
37
38
|
} = getLocalFontUrl(fontSource, fontFamily);
|
|
38
39
|
return expoModules.ExpoAsset.downloadAsync(uri, hash, type);
|
|
39
40
|
})();
|
|
40
|
-
|
|
41
|
+
const asset = _reactNative.Platform.select({
|
|
42
|
+
web: {
|
|
43
|
+
uri: localUri,
|
|
44
|
+
display: 'auto'
|
|
45
|
+
},
|
|
46
|
+
default: localUri
|
|
47
|
+
});
|
|
48
|
+
await expoModules.ExpoFontLoader.loadAsync(fontFamily, asset);
|
|
41
49
|
} catch (error) {
|
|
42
50
|
console.error(`Failed to load font ${fontFamily}`, error); // eslint-disable-line no-console
|
|
43
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_registry","_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":";;;;;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_registry","_dynamicLoadingSetting","loadPromises","loadFontAsync","fontFamily","fontSource","globalRef","globalThis","assertExpoModulesPresent","expoModules","expo","modules","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","asset","Platform","select","web","display","default","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":";;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AAVA;AACA;AACA;AACA;;AAGA;AACA;;AAMA,MAAMG,YAAqD,GAAG,CAAC,CAAC;AAEhE,MAAMC,aAAa,GAAG,MAAAA,CAAOC,UAAkB,EAAEC,UAAsB,KAAoB;EACzF,MAAMC,SAAS,GAAGC,UAAU;EAC5B,IAAAC,+CAAwB,EAACF,SAAS,CAAC;EAEnC,MAAMG,WAAW,GAAGH,SAAS,CAACI,IAAI,CAACC,OAAO;EAE1C,IAAIT,YAAY,CAACE,UAAU,CAAC,EAAE;IAC5B,OAAOF,YAAY,CAACE,UAAU,CAAC;EACjC;EAEAF,YAAY,CAACE,UAAU,CAAC,GAAI,eAAeQ,QAAQA,CAAA,EAAG;IACpD,IAAI;MACF,MAAMC,QAAQ,GAAG,MAAM,CAAC,MAAM;QAC5B,IAAI,OAAOR,UAAU,KAAK,QAAQ,EAAE;UAClC;UACA,OAAOA,UAAU;QACnB;QACA;QACA,MAAM;UAAES,GAAG;UAAEC,IAAI;UAAEC;QAAK,CAAC,GAAGC,eAAe,CAAC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A,UAAU,IAAImC,gBAAgB,EAAE;IAClC,OAAO,IAAI;EACb;EACA,MAAMjC,SAAS,GAAGC,UAAU;EAC5B,IAAAC,+CAAwB,EAACF,SAAS,CAAC;EAEnC,MAAMmC,iBAAiB,GAAGnC,SAAS,CAACI,IAAI,CAACC,OAAO,CAACe,cAAc,CAACgB,cAAc,CAAC,CAAC;EAChFD,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAOxC,UAAU,IAAImC,gBAAgB;AACvC,CAAC;AAEM,MAAMM,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CE,QAAQ,EAAEP,cAAc;EACxBrC;AACF,CAAC","ignoreList":[]}
|
|
@@ -7,9 +7,12 @@ exports.assertExpoModulesPresent = assertExpoModulesPresent;
|
|
|
7
7
|
exports.getErrorCallback = void 0;
|
|
8
8
|
exports.getIsRenderToImageSupported = getIsRenderToImageSupported;
|
|
9
9
|
exports.setDynamicLoadingErrorCallback = exports.setDynamicLoadingEnabled = exports.isDynamicLoadingSupported = exports.isDynamicLoadingEnabled = void 0;
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
// this is a file:// uri on native, or an object with uri and display on web
|
|
12
|
+
|
|
10
13
|
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
11
14
|
function getIsDynamicLoadingSupported(globalObj) {
|
|
12
|
-
return globalObj?.expo && typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function';
|
|
15
|
+
return globalObj?.expo && (_reactNative.Platform.OS === 'web' || typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function') && typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function';
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
@@ -18,10 +21,10 @@ function getIsRenderToImageSupported(globalObj) {
|
|
|
18
21
|
}
|
|
19
22
|
function assertExpoModulesPresent(globalObj) {
|
|
20
23
|
if (!getIsDynamicLoadingSupported(globalObj)) {
|
|
21
|
-
throw new Error('Dynamic font loading
|
|
24
|
+
throw new Error('Dynamic font loading not supported. Upgrade to latest expo and expo-font.');
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
27
|
+
const hasNecessaryExpoModules = (_reactNative.Platform.OS === 'web' || !!globalThis.expo?.modules?.ExpoAsset) && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
25
28
|
const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
|
|
26
29
|
let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
|
|
27
30
|
const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
|
|
@@ -38,7 +41,7 @@ exports.isDynamicLoadingSupported = isDynamicLoadingSupported;
|
|
|
38
41
|
const setDynamicLoadingEnabled = value => {
|
|
39
42
|
if (!hasNecessaryExpoFeatures) {
|
|
40
43
|
if (process.env.NODE_ENV !== 'production' && !!value) {
|
|
41
|
-
const message = hasNecessaryExpoModules ? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK
|
|
44
|
+
const message = hasNecessaryExpoModules ? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK 54 or newer.' : 'Necessary Expo modules not found. Dynamic font loading is not available when necessary Expo modules are not present.';
|
|
42
45
|
console.error(message); // eslint-disable-line no-console
|
|
43
46
|
}
|
|
44
47
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsDynamicLoadingSupported","globalObj","expo","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","getIsRenderToImageSupported","ExpoFontUtils","renderToImageAsync","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":";;;;;;;;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","getIsDynamicLoadingSupported","globalObj","expo","Platform","OS","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","getIsRenderToImageSupported","ExpoFontUtils","renderToImageAsync","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":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA;;AAyCA;AACA,SAASC,4BAA4BA,CAACC,SAAc,EAElD;EACA,OACEA,SAAS,EAAEC,IAAI,KACdC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,OAAOH,SAAS,CAACC,IAAI,CAACG,OAAO,EAAEC,SAAS,EAAEC,aAAa,KAAK,UAAU,CAAC,IACjG,OAAON,SAAS,CAACC,IAAI,CAACG,OAAO,EAAEG,cAAc,EAAEC,cAAc,KAAK,UAAU,IAC5E,OAAOR,SAAS,CAACC,IAAI,CAACG,OAAO,EAAEG,cAAc,EAAEE,SAAS,KAAK,UAAU;AAE3E;;AAEA;AACO,SAASC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AAAS,uBAAA,GAAAA,uBAAA;AAIvE,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":[]}
|
|
@@ -6,8 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getFontPaths = void 0;
|
|
7
7
|
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
8
8
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
9
|
-
var
|
|
9
|
+
var _findUp = require("find-up");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Source vendored and simplified from @react-native-coommunity/cli
|
|
13
|
+
*/
|
|
14
|
+
const resolveNodeModuleDir = (root, pkgName) => {
|
|
15
|
+
const packageDir = (0, _findUp.findUpSync)(_nodePath.default.join('node_modules', pkgName), {
|
|
16
|
+
cwd: root,
|
|
17
|
+
type: 'directory'
|
|
18
|
+
});
|
|
19
|
+
return packageDir;
|
|
20
|
+
};
|
|
11
21
|
const getPackageJson = filename => {
|
|
12
22
|
const packageData = _nodeFs.default.readFileSync(filename, 'utf-8');
|
|
13
23
|
const packageJson = JSON.parse(packageData);
|
|
@@ -18,7 +28,7 @@ const getPackageFontDirectories = packageJsonFilename => {
|
|
|
18
28
|
const dependencies = Object.keys(rootPackageJson.dependencies || {});
|
|
19
29
|
const packageDirs = [];
|
|
20
30
|
dependencies.forEach(dependency => {
|
|
21
|
-
const dir =
|
|
31
|
+
const dir = resolveNodeModuleDir(packageJsonFilename, dependency);
|
|
22
32
|
const packageJson = getPackageJson(`${dir}/package.json`);
|
|
23
33
|
if (packageJson.keywords?.includes?.('react-native-vector-icons-icon')) {
|
|
24
34
|
packageDirs.push(`${dir}/fonts`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nodeFs","_interopRequireDefault","require","_nodePath","
|
|
1
|
+
{"version":3,"names":["_nodeFs","_interopRequireDefault","require","_nodePath","_findUp","e","__esModule","default","resolveNodeModuleDir","root","pkgName","packageDir","findUpSync","path","join","cwd","type","getPackageJson","filename","packageData","fs","readFileSync","packageJson","JSON","parse","getPackageFontDirectories","packageJsonFilename","rootPackageJson","dependencies","Object","keys","packageDirs","forEach","dependency","dir","keywords","includes","push","getLocalFontsDir","config","reactNativeVectorIcons","dirname","fontDir","getFonts","existsSync","fonts","readdirSync","fontPaths","map","font","getFontPaths","flat","exports"],"sourceRoot":"../../../src","sources":["scripts/common.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAAqC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErC;AACA;AACA;AACA,MAAMG,oBAAoB,GAAGA,CAACC,IAAY,EAAEC,OAAe,KAAK;EAC9D,MAAMC,UAAU,GAAG,IAAAC,kBAAU,EAACC,iBAAI,CAACC,IAAI,CAAC,cAAc,EAAEJ,OAAO,CAAC,EAAE;IAChEK,GAAG,EAAEN,IAAI;IACTO,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,OAAOL,UAAU;AACnB,CAAC;AAED,MAAMM,cAAc,GAAIC,QAAgB,IAAK;EAC3C,MAAMC,WAAW,GAAGC,eAAE,CAACC,YAAY,CAACH,QAAQ,EAAE,OAAO,CAAC;EACtD,MAAMI,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACL,WAAW,CAAC;EAE3C,OAAOG,WAAW;AACpB,CAAC;AAED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AK;EAC3D,MAAMK,WAAW,GAAGN,yBAAyB,CAACC,mBAAmB,CAAC;EAClEK,WAAW,CAACM,IAAI,CAACC,gBAAgB,CAACZ,mBAAmB,CAAC,CAAC;EACvD,MAAMmB,KAAK,GAAGd,WAAW,CAACiB,GAAG,CAACL,QAAQ,CAAC;EAEvC,OAAOE,KAAK,CAACM,IAAI,CAAC,CAAC;AACrB,CAAC;AAACC,OAAA,CAAAF,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import React, { forwardRef, useEffect } from 'react';
|
|
|
6
6
|
import { Platform, Text } from 'react-native';
|
|
7
7
|
import createIconSourceCache from "./create-icon-source-cache.js";
|
|
8
8
|
import { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from "./defaults.js";
|
|
9
|
-
import { dynamicLoader } from
|
|
9
|
+
import { dynamicLoader } from "./dynamicLoading/dynamic-font-loading.js";
|
|
10
10
|
import { isDynamicLoadingEnabled } from "./dynamicLoading/dynamic-loading-setting.js";
|
|
11
11
|
import { getImageSource as getImageSourceImpl, getImageSourceSync as getImageSourceSyncImpl } from "./get-image-source.js";
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -85,7 +85,7 @@ export function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNamePar
|
|
|
85
85
|
innerRef: ref,
|
|
86
86
|
...props
|
|
87
87
|
}));
|
|
88
|
-
WrappedIcon.displayName =
|
|
88
|
+
WrappedIcon.displayName = `Icon(${postScriptName})`;
|
|
89
89
|
const imageSourceCache = createIconSourceCache();
|
|
90
90
|
const getImageSource = async (name, size, color) => {
|
|
91
91
|
if (typeof postScriptNameOrOptions === 'object' && typeof postScriptNameOrOptions.fontSource !== 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","Platform","Text","createIconSourceCache","DEFAULT_ICON_COLOR","DEFAULT_ICON_SIZE","dynamicLoader","isDynamicLoadingEnabled","getImageSource","getImageSourceImpl","getImageSourceSync","getImageSourceSyncImpl","jsxs","_jsxs","jsx","_jsx","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","IconNamespace","Object","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,UAAU,EAAYC,SAAS,QAAQ,OAAO;AAC9D;AACA,SAASC,QAAQ,EAAEC,IAAI,QAAwC,cAAc;AAE7E,OAAOC,qBAAqB,MAAM,+BAA4B;AAC9D,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,eAAY;AAClE,SAASC,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","Platform","Text","createIconSourceCache","DEFAULT_ICON_COLOR","DEFAULT_ICON_SIZE","dynamicLoader","isDynamicLoadingEnabled","getImageSource","getImageSourceImpl","getImageSourceSync","getImageSourceSyncImpl","jsxs","_jsxs","jsx","_jsx","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","IconNamespace","Object","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAA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3
|
/*
|
|
6
4
|
* The following imports are always present when react native is installed
|
|
7
5
|
* in the future, more explicit apis will be exposed by the core, including typings
|
|
8
6
|
* */
|
|
7
|
+
import { Image, Platform } from 'react-native';
|
|
8
|
+
|
|
9
9
|
// @ts-expect-error missing types
|
|
10
10
|
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
|
|
11
11
|
import { getAssetByID } from '@react-native/assets-registry/registry';
|
|
@@ -33,7 +33,14 @@ const loadFontAsync = async (fontFamily, fontSource) => {
|
|
|
33
33
|
} = getLocalFontUrl(fontSource, fontFamily);
|
|
34
34
|
return expoModules.ExpoAsset.downloadAsync(uri, hash, type);
|
|
35
35
|
})();
|
|
36
|
-
|
|
36
|
+
const asset = Platform.select({
|
|
37
|
+
web: {
|
|
38
|
+
uri: localUri,
|
|
39
|
+
display: 'auto'
|
|
40
|
+
},
|
|
41
|
+
default: localUri
|
|
42
|
+
});
|
|
43
|
+
await expoModules.ExpoFontLoader.loadAsync(fontFamily, asset);
|
|
37
44
|
} catch (error) {
|
|
38
45
|
console.error(`Failed to load font ${fontFamily}`, error); // eslint-disable-line no-console
|
|
39
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Image","getAssetByID","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,SAASA,KAAK,QAAQ,cAAc;;
|
|
1
|
+
{"version":3,"names":["Image","Platform","getAssetByID","assertExpoModulesPresent","getErrorCallback","loadPromises","loadFontAsync","fontFamily","fontSource","globalRef","globalThis","expoModules","expo","modules","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","asset","select","web","display","default","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,SAASA,KAAK,EAAEC,QAAQ,QAAQ,cAAc;;AAE9C;AACA;AACA,SAASC,YAAY,QAAQ,wCAAwC;AAErE,SAASC,wBAAwB,EAAEC,gBAAgB,QAA6B,8BAA2B;AAG3G,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,MAAMK,KAAK,GAAGrB,QAAQ,CAACsB,MAAM,CAAiB;QAC5CC,GAAG,EA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,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAOnC,UAAU,IAAI8B,gBAAgB;AACvC,CAAC;AAED,OAAO,MAAMM,aAA4B,GAAG;EAC1CC,QAAQ,EAAEN,cAAc;EACxBhC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// this is a file:// uri on native, or an object with uri and display on web
|
|
6
|
+
|
|
3
7
|
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
4
8
|
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';
|
|
9
|
+
return globalObj?.expo && (Platform.OS === 'web' || typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function') && typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' && typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function';
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
// biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
|
|
@@ -11,10 +15,10 @@ export function getIsRenderToImageSupported(globalObj) {
|
|
|
11
15
|
}
|
|
12
16
|
export function assertExpoModulesPresent(globalObj) {
|
|
13
17
|
if (!getIsDynamicLoadingSupported(globalObj)) {
|
|
14
|
-
throw new Error('Dynamic font loading
|
|
18
|
+
throw new Error('Dynamic font loading not supported. Upgrade to latest expo and expo-font.');
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
|
-
const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
21
|
+
const hasNecessaryExpoModules = (Platform.OS === 'web' || !!globalThis.expo?.modules?.ExpoAsset) && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
18
22
|
const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
|
|
19
23
|
let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
|
|
20
24
|
export const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
|
|
@@ -30,7 +34,7 @@ export const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
|
|
|
30
34
|
export const setDynamicLoadingEnabled = value => {
|
|
31
35
|
if (!hasNecessaryExpoFeatures) {
|
|
32
36
|
if (process.env.NODE_ENV !== 'production' && !!value) {
|
|
33
|
-
const message = hasNecessaryExpoModules ? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK
|
|
37
|
+
const message = hasNecessaryExpoModules ? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK 54 or newer.' : 'Necessary Expo modules not found. Dynamic font loading is not available when necessary Expo modules are not present.';
|
|
34
38
|
console.error(message); // eslint-disable-line no-console
|
|
35
39
|
}
|
|
36
40
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsDynamicLoadingSupported","globalObj","expo","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","getIsRenderToImageSupported","ExpoFontUtils","renderToImageAsync","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":";;
|
|
1
|
+
{"version":3,"names":["Platform","getIsDynamicLoadingSupported","globalObj","expo","OS","modules","ExpoAsset","downloadAsync","ExpoFontLoader","getLoadedFonts","loadAsync","getIsRenderToImageSupported","ExpoFontUtils","renderToImageAsync","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":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAUvC;;AAyCA;AACA,SAASC,4BAA4BA,CAACC,SAAc,EAElD;EACA,OACEA,SAAS,EAAEC,IAAI,KACdH,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,OAAOF,SAAS,CAACC,IAAI,CAACE,OAAO,EAAEC,SAAS,EAAEC,aAAa,KAAK,UAAU,CAAC,IACjG,OAAOL,SAAS,CAACC,IAAI,CAACE,OAAO,EAAEG,cAAc,EAAEC,cAAc,KAAK,UAAU,IAC5E,OAAOP,SAAS,CAACC,IAAI,CAACE,OAAO,EAAEG,cAAc,EAAEE,SAAS,KAAK,UAAU;AAE3E;;AAEA;AACA,OAAO,SAASC,2BAA2BA,CAACT,SAAc,EAMxD;EACA,OAAOA,SAAS,EAAEC,IAAI,IAAI,OAAOD,SAAS,CAACC,IAAI,CAACE,OAAO,EAAEO,aAAa,EAAEC,kBAAkB,KAAK,UAAU;AAC3G;AAEA,OAAO,SAASC,wBAAwBA,CAACZ,SAAkB,EAAiD;EAC1G,IAAI,CAACD,4BAA4B,CAACC,SAAS,CAAC,EAAE;IAC5C,MAAM,IAAIa,KAAK,CAAC,2EAA2E,CAAC;EAC9F;AACF;AAEA,MAAMC,uBAAuB,GAC3B,CAAChB,QAAQ,CAACI,EAAE,KAAK,KAAK,IAAI,CAAC,CAACa,UAAU,CAACd,IAAI,EAAEE,OAAO,EAAEC,SAAS,KAAK,CAAC,CAACW,UAAU,CAACd,IAAI,EAAEE,OAAO,EAAEG,cAAc;AAEhH,MAAMU,wBAAwB,GAAGjB,4BAA4B,CAACgB,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,sHAAsH;MAC1HW,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;AAItE,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":[]}
|
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
5
|
+
import { findUpSync } from 'find-up';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Source vendored and simplified from @react-native-coommunity/cli
|
|
9
|
+
*/
|
|
10
|
+
const resolveNodeModuleDir = (root, pkgName) => {
|
|
11
|
+
const packageDir = findUpSync(path.join('node_modules', pkgName), {
|
|
12
|
+
cwd: root,
|
|
13
|
+
type: 'directory'
|
|
14
|
+
});
|
|
15
|
+
return packageDir;
|
|
16
|
+
};
|
|
6
17
|
const getPackageJson = filename => {
|
|
7
18
|
const packageData = fs.readFileSync(filename, 'utf-8');
|
|
8
19
|
const packageJson = JSON.parse(packageData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fs","path","resolveNodeModuleDir","getPackageJson","filename","packageData","readFileSync","packageJson","JSON","parse","getPackageFontDirectories","packageJsonFilename","rootPackageJson","dependencies","Object","keys","packageDirs","forEach","dependency","dir","keywords","includes","push","getLocalFontsDir","config","reactNativeVectorIcons","dirname","fontDir","getFonts","existsSync","fonts","readdirSync","fontPaths","map","font","getFontPaths","flat"],"sourceRoot":"../../../src","sources":["scripts/common.ts"],"mappings":";;AAAA,OAAOA,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAE5B,SAASC,
|
|
1
|
+
{"version":3,"names":["fs","path","findUpSync","resolveNodeModuleDir","root","pkgName","packageDir","join","cwd","type","getPackageJson","filename","packageData","readFileSync","packageJson","JSON","parse","getPackageFontDirectories","packageJsonFilename","rootPackageJson","dependencies","Object","keys","packageDirs","forEach","dependency","dir","keywords","includes","push","getLocalFontsDir","config","reactNativeVectorIcons","dirname","fontDir","getFonts","existsSync","fonts","readdirSync","fontPaths","map","font","getFontPaths","flat"],"sourceRoot":"../../../src","sources":["scripts/common.ts"],"mappings":";;AAAA,OAAOA,EAAE,MAAM,SAAS;AACxB,OAAOC,IAAI,MAAM,WAAW;AAE5B,SAASC,UAAU,QAAQ,SAAS;;AAEpC;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGA,CAACC,IAAY,EAAEC,OAAe,KAAK;EAC9D,MAAMC,UAAU,GAAGJ,UAAU,CAACD,IAAI,CAACM,IAAI,CAAC,cAAc,EAAEF,OAAO,CAAC,EAAE;IAChEG,GAAG,EAAEJ,IAAI;IACTK,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,OAAOH,UAAU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G,KAAK,GAAGrC,EAAE,CAACsC,WAAW,CAACJ,OAAO,CAAC;EACrC,MAAMK,SAAS,GAAGF,KAAK,CAACG,GAAG,CAAEC,IAAI,IAAK,GAAGP,OAAO,IAAIO,IAAI,EAAE,CAAC;EAE3D,OAAOF,SAAS;AAClB,CAAC;AAED,OAAO,MAAMG,YAAY,GAAIxB,mBAA2B,IAAK;EAC3D,MAAMK,WAAW,GAAGN,yBAAyB,CAACC,mBAAmB,CAAC;EAClEK,WAAW,CAACM,IAAI,CAACC,gBAAgB,CAACZ,mBAAmB,CAAC,CAAC;EACvD,MAAMmB,KAAK,GAAGd,WAAW,CAACiB,GAAG,CAACL,QAAQ,CAAC;EAEvC,OAAOE,KAAK,CAACM,IAAI,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ export type IconProps<T> = TextProps & {
|
|
|
13
13
|
color?: TextStyle['color'];
|
|
14
14
|
innerRef?: Ref<Text>;
|
|
15
15
|
};
|
|
16
|
-
type IconComponent<GM extends Record<string, number>> = React.FC<TextProps & {
|
|
16
|
+
export type IconComponent<GM extends Record<string, number>> = React.FC<TextProps & {
|
|
17
17
|
name: keyof GM;
|
|
18
18
|
size?: number;
|
|
19
19
|
color?: TextStyle['color'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-icon-set.d.ts","sourceRoot":"","sources":["../../../../src/create-icon-set.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,GAAG,EAAa,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAY,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,KAAK,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAChD,KAAK,0BAA0B,CAAC,EA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,CAAC,EAAE,CAAC,CAAC;AACrB,wBAAgB,aAAa,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7D,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAkFzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -2,9 +2,13 @@ import type { FontSource } from './types';
|
|
|
2
2
|
type ExpoAssetModule = {
|
|
3
3
|
downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
|
|
4
4
|
};
|
|
5
|
+
export type LoadAsyncAsset = string | {
|
|
6
|
+
uri: string;
|
|
7
|
+
display: string;
|
|
8
|
+
};
|
|
5
9
|
type ExpoFontLoaderModule = {
|
|
6
10
|
getLoadedFonts: () => string[];
|
|
7
|
-
loadAsync: (fontFamilyAlias: string,
|
|
11
|
+
loadAsync: (fontFamilyAlias: string, asset: LoadAsyncAsset) => Promise<void>;
|
|
8
12
|
};
|
|
9
13
|
type ExpoFontUtilsModule = {
|
|
10
14
|
renderToImageAsync: (glyph: string, options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"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,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI;IACxE,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,aAAa,EAAE,mBAAmB,CAAC;SACpC,CAAC;KACH,CAAC;CACH,CAEA;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,IAAI;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAI1G;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;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAAC;AAIlG;;KAEK;AACL,eAAO,MAAM,8BAA8B,GAAI,UAAU,aAAa,SAErE,CAAC;AAEF,eAAO,MAAM,gBAAgB,iCAAoC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CreateIconSetOptions, IconProps } from './create-icon-set';
|
|
1
|
+
export type { CreateIconSetOptions, IconComponent, IconProps } from './create-icon-set';
|
|
2
2
|
export { createIconSet } from './create-icon-set';
|
|
3
3
|
export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './defaults';
|
|
4
4
|
export { isDynamicLoadingEnabled, isDynamicLoadingSupported, setDynamicLoadingEnabled, setDynamicLoadingErrorCallback, } from './dynamicLoading/dynamic-loading-setting';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,0CAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/common.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,YAAY,GAAI,qBAAqB,MAAM,aAMvD,CAAC"}
|
|
@@ -13,7 +13,7 @@ export type IconProps<T> = TextProps & {
|
|
|
13
13
|
color?: TextStyle['color'];
|
|
14
14
|
innerRef?: Ref<Text>;
|
|
15
15
|
};
|
|
16
|
-
type IconComponent<GM extends Record<string, number>> = React.FC<TextProps & {
|
|
16
|
+
export type IconComponent<GM extends Record<string, number>> = React.FC<TextProps & {
|
|
17
17
|
name: keyof GM;
|
|
18
18
|
size?: number;
|
|
19
19
|
color?: TextStyle['color'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-icon-set.d.ts","sourceRoot":"","sources":["../../../../src/create-icon-set.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,GAAG,EAAa,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAY,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,KAAK,SAAS,GAAG;IAAE,GAAG,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AAM,EACtB,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAC7B,aAAa,CAAC,EAAE,CAAC,CAAC;AACrB,wBAAgB,aAAa,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7D,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamic-font-loading.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAkFzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -2,9 +2,13 @@ import type { FontSource } from './types';
|
|
|
2
2
|
type ExpoAssetModule = {
|
|
3
3
|
downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
|
|
4
4
|
};
|
|
5
|
+
export type LoadAsyncAsset = string | {
|
|
6
|
+
uri: string;
|
|
7
|
+
display: string;
|
|
8
|
+
};
|
|
5
9
|
type ExpoFontLoaderModule = {
|
|
6
10
|
getLoadedFonts: () => string[];
|
|
7
|
-
loadAsync: (fontFamilyAlias: string,
|
|
11
|
+
loadAsync: (fontFamilyAlias: string, asset: LoadAsyncAsset) => Promise<void>;
|
|
8
12
|
};
|
|
9
13
|
type ExpoFontUtilsModule = {
|
|
10
14
|
renderToImageAsync: (glyph: string, options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-loading-setting.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-loading-setting.ts"],"names":[],"mappings":"AAEA,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;AAGF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,KAAK,oBAAoB,GAAG;IAG1B,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,KACE,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,OAAO,EAAE;YACP,SAAS,CAAC,EAAE,eAAe,CAAC;YAC5B,cAAc,CAAC,EAAE,oBAAoB,CAAC;YACtC,aAAa,CAAC,EAAE,mBAAmB,CAAC;SACrC,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;AAeF,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI;IACxE,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,aAAa,EAAE,mBAAmB,CAAC;SACpC,CAAC;KACH,CAAC;CACH,CAEA;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,IAAI;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAI1G;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;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAAC;AAIlG;;KAEK;AACL,eAAO,MAAM,8BAA8B,GAAI,UAAU,aAAa,SAErE,CAAC;AAEF,eAAO,MAAM,gBAAgB,iCAAoC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CreateIconSetOptions, IconProps } from './create-icon-set';
|
|
1
|
+
export type { CreateIconSetOptions, IconComponent, IconProps } from './create-icon-set';
|
|
2
2
|
export { createIconSet } from './create-icon-set';
|
|
3
3
|
export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './defaults';
|
|
4
4
|
export { isDynamicLoadingEnabled, isDynamicLoadingSupported, setDynamicLoadingEnabled, setDynamicLoadingErrorCallback, } from './dynamicLoading/dynamic-loading-setting';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,0CAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/common.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,YAAY,GAAI,qBAAqB,MAAM,aAMvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-vector-icons/common",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
4
4
|
"description": "Customizable Icons for React Native with support for image source and full styling.",
|
|
5
|
-
"source": "./src/index.
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
7
7
|
"module": "./lib/module/index.js",
|
|
8
8
|
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"registry": "https://registry.npmjs.org/"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"
|
|
73
|
+
"find-up": "^7.0.0",
|
|
74
74
|
"picocolors": "^1.1.1",
|
|
75
75
|
"plist": "^3.1.0"
|
|
76
76
|
},
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"react": "*",
|
|
87
87
|
"react-native": "*",
|
|
88
|
-
"@react-native-vector-icons/get-image": "^12.
|
|
88
|
+
"@react-native-vector-icons/get-image": "^12.2.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependenciesMeta": {
|
|
91
91
|
"@react-native-vector-icons/get-image": {
|
|
@@ -131,6 +131,15 @@
|
|
|
131
131
|
"type": "library",
|
|
132
132
|
"version": "0.41.2"
|
|
133
133
|
},
|
|
134
|
+
"nx": {
|
|
135
|
+
"targets": {
|
|
136
|
+
"build": {
|
|
137
|
+
"dependsOn": [
|
|
138
|
+
"@react-native-vector-icons/get-image:build"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
134
143
|
"scripts": {
|
|
135
144
|
"clean": "del-cli lib",
|
|
136
145
|
"watch": "onchange 'src/**' --initial -- pnpm run prepare"
|
package/src/create-icon-set.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export type IconProps<T> = TextProps & {
|
|
|
25
25
|
innerRef?: Ref<Text>;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
type IconComponent<GM extends Record<string, number>> = React.FC<
|
|
28
|
+
export type IconComponent<GM extends Record<string, number>> = React.FC<
|
|
29
29
|
TextProps & {
|
|
30
30
|
name: keyof GM;
|
|
31
31
|
size?: number;
|
|
@@ -150,7 +150,7 @@ export function createIconSet<GM extends Record<string, number>>(
|
|
|
150
150
|
const WrappedIcon = forwardRef<Text, IconProps<keyof typeof glyphMap>>((props, ref) => (
|
|
151
151
|
<Icon innerRef={ref} {...props} />
|
|
152
152
|
));
|
|
153
|
-
WrappedIcon.displayName =
|
|
153
|
+
WrappedIcon.displayName = `Icon(${postScriptName})`;
|
|
154
154
|
|
|
155
155
|
const imageSourceCache = createIconSourceCache();
|
|
156
156
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Image } from 'react-native';
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* The following imports are always present when react native is installed
|
|
5
3
|
* in the future, more explicit apis will be exposed by the core, including typings
|
|
6
4
|
* */
|
|
5
|
+
import { Image, Platform } from 'react-native';
|
|
6
|
+
|
|
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
10
|
|
|
11
|
-
import { assertExpoModulesPresent, getErrorCallback } from './dynamic-loading-setting';
|
|
11
|
+
import { assertExpoModulesPresent, getErrorCallback, type LoadAsyncAsset } from './dynamic-loading-setting';
|
|
12
12
|
import type { DynamicLoader, FontSource } from './types';
|
|
13
13
|
|
|
14
14
|
const loadPromises: { [fontSource: string]: Promise<void> } = {};
|
|
@@ -35,7 +35,11 @@ const loadFontAsync = async (fontFamily: string, fontSource: FontSource): Promis
|
|
|
35
35
|
return expoModules.ExpoAsset.downloadAsync(uri, hash, type);
|
|
36
36
|
})();
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const asset = Platform.select<LoadAsyncAsset>({
|
|
39
|
+
web: { uri: localUri, display: 'auto' },
|
|
40
|
+
default: localUri,
|
|
41
|
+
});
|
|
42
|
+
await expoModules.ExpoFontLoader.loadAsync(fontFamily, asset);
|
|
39
43
|
} catch (error) {
|
|
40
44
|
console.error(`Failed to load font ${fontFamily}`, error); // eslint-disable-line no-console
|
|
41
45
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
1
3
|
import type { FontSource } from './types';
|
|
2
4
|
|
|
3
5
|
type ExpoAssetModule = {
|
|
@@ -6,11 +8,14 @@ type ExpoAssetModule = {
|
|
|
6
8
|
downloadAsync: (uri: string, hash: string | undefined, type: string) => Promise<string>;
|
|
7
9
|
};
|
|
8
10
|
|
|
11
|
+
// this is a file:// uri on native, or an object with uri and display on web
|
|
12
|
+
export type LoadAsyncAsset = string | { uri: string; display: string };
|
|
13
|
+
|
|
9
14
|
type ExpoFontLoaderModule = {
|
|
10
15
|
// definition from
|
|
11
16
|
// https://github.com/expo/expo/blob/1f5a5991d14aad09282d1ce1612b44d30e7e7d3d/packages/expo-font/ios/FontLoaderModule.swift#L18
|
|
12
17
|
getLoadedFonts: () => string[];
|
|
13
|
-
loadAsync: (fontFamilyAlias: string,
|
|
18
|
+
loadAsync: (fontFamilyAlias: string, asset: LoadAsyncAsset) => Promise<void>;
|
|
14
19
|
};
|
|
15
20
|
|
|
16
21
|
type ExpoFontUtilsModule = {
|
|
@@ -50,7 +55,7 @@ function getIsDynamicLoadingSupported(globalObj: any): globalObj is {
|
|
|
50
55
|
} {
|
|
51
56
|
return (
|
|
52
57
|
globalObj?.expo &&
|
|
53
|
-
typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function' &&
|
|
58
|
+
(Platform.OS === 'web' || typeof globalObj.expo.modules?.ExpoAsset?.downloadAsync === 'function') &&
|
|
54
59
|
typeof globalObj.expo.modules?.ExpoFontLoader?.getLoadedFonts === 'function' &&
|
|
55
60
|
typeof globalObj.expo.modules?.ExpoFontLoader?.loadAsync === 'function'
|
|
56
61
|
);
|
|
@@ -69,11 +74,12 @@ export function getIsRenderToImageSupported(globalObj: any): globalObj is {
|
|
|
69
74
|
|
|
70
75
|
export function assertExpoModulesPresent(globalObj: unknown): asserts globalObj is { expo: ExpoGlobalType } {
|
|
71
76
|
if (!getIsDynamicLoadingSupported(globalObj)) {
|
|
72
|
-
throw new Error('Dynamic font loading
|
|
77
|
+
throw new Error('Dynamic font loading not supported. Upgrade to latest expo and expo-font.');
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
const hasNecessaryExpoModules =
|
|
81
|
+
const hasNecessaryExpoModules =
|
|
82
|
+
(Platform.OS === 'web' || !!globalThis.expo?.modules?.ExpoAsset) && !!globalThis.expo?.modules?.ExpoFontLoader;
|
|
77
83
|
|
|
78
84
|
const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
|
|
79
85
|
|
|
@@ -93,8 +99,8 @@ export const setDynamicLoadingEnabled = (value: boolean): boolean => {
|
|
|
93
99
|
if (!hasNecessaryExpoFeatures) {
|
|
94
100
|
if (process.env.NODE_ENV !== 'production' && !!value) {
|
|
95
101
|
const message = hasNecessaryExpoModules
|
|
96
|
-
? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK
|
|
97
|
-
: 'Necessary Expo modules not found. Dynamic font loading is not available
|
|
102
|
+
? 'Expo is installed, but does not support dynamic font loading. Make sure to use Expo SDK 54 or newer.'
|
|
103
|
+
: 'Necessary Expo modules not found. Dynamic font loading is not available when necessary Expo modules are not present.';
|
|
98
104
|
console.error(message); // eslint-disable-line no-console
|
|
99
105
|
}
|
|
100
106
|
return false;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CreateIconSetOptions, IconProps } from './create-icon-set';
|
|
1
|
+
export type { CreateIconSetOptions, IconComponent, IconProps } from './create-icon-set';
|
|
2
2
|
export { createIconSet } from './create-icon-set';
|
|
3
3
|
export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './defaults';
|
|
4
4
|
export {
|
package/src/scripts/common.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { findUpSync } from 'find-up';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Source vendored and simplified from @react-native-coommunity/cli
|
|
8
|
+
*/
|
|
9
|
+
const resolveNodeModuleDir = (root: string, pkgName: string) => {
|
|
10
|
+
const packageDir = findUpSync(path.join('node_modules', pkgName), {
|
|
11
|
+
cwd: root,
|
|
12
|
+
type: 'directory',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return packageDir;
|
|
16
|
+
};
|
|
5
17
|
|
|
6
18
|
const getPackageJson = (filename: string) => {
|
|
7
19
|
const packageData = fs.readFileSync(filename, 'utf-8');
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dynamicLoader = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* dynamic font loading isn't supported on web
|
|
9
|
-
* */
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
-
const loadFontAsync = async (_fontFamily, _fontSource) => undefined;
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
-
const isLoaded = _fontFamily => true;
|
|
16
|
-
const dynamicLoader = exports.dynamicLoader = {
|
|
17
|
-
isLoaded,
|
|
18
|
-
loadFontAsync
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=dynamic-font-loading.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["loadFontAsync","_fontFamily","_fontSource","undefined","isLoaded","dynamicLoader","exports"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-font-loading.web.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAGA;AACA,MAAMA,aAAa,GAAG,MAAAA,CAAOC,WAAmB,EAAEC,WAAuB,KAAoBC,SAAS;;AAEtG;AACA,MAAMC,QAAQ,GAAIH,WAAmB,IAAK,IAAI;AAEvC,MAAMI,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CD,QAAQ;EACRJ;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* dynamic font loading isn't supported on web
|
|
5
|
-
* */
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
-
const loadFontAsync = async (_fontFamily, _fontSource) => undefined;
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
-
const isLoaded = _fontFamily => true;
|
|
12
|
-
export const dynamicLoader = {
|
|
13
|
-
isLoaded,
|
|
14
|
-
loadFontAsync
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=dynamic-font-loading.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["loadFontAsync","_fontFamily","_fontSource","undefined","isLoaded","dynamicLoader"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-font-loading.web.ts"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA,MAAMA,aAAa,GAAG,MAAAA,CAAOC,WAAmB,EAAEC,WAAuB,KAAoBC,SAAS;;AAEtG;AACA,MAAMC,QAAQ,GAAIH,WAAmB,IAAK,IAAI;AAE9C,OAAO,MAAMI,aAA4B,GAAG;EAC1CD,QAAQ;EACRJ;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.web.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.web.ts"],"names":[],"mappings":"AAAA;;KAEK;AACL,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAQzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-font-loading.web.d.ts","sourceRoot":"","sources":["../../../../../src/dynamicLoading/dynamic-font-loading.web.ts"],"names":[],"mappings":"AAAA;;KAEK;AACL,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,SAAS,CAAC;AAQzD,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dynamic font loading isn't supported on web
|
|
3
|
-
* */
|
|
4
|
-
import type { DynamicLoader, FontSource } from './types';
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
-
const loadFontAsync = async (_fontFamily: string, _fontSource: FontSource): Promise<void> => undefined;
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
const isLoaded = (_fontFamily: string) => true;
|
|
11
|
-
|
|
12
|
-
export const dynamicLoader: DynamicLoader = {
|
|
13
|
-
isLoaded,
|
|
14
|
-
loadFontAsync,
|
|
15
|
-
};
|