@react-native-vector-icons/common 12.0.0 → 12.1.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.
Files changed (80) hide show
  1. package/README.md +50 -38
  2. package/lib/commonjs/create-icon-set.js +16 -58
  3. package/lib/commonjs/create-icon-set.js.map +1 -1
  4. package/lib/commonjs/create-icon-source-cache.js +0 -2
  5. package/lib/commonjs/create-icon-source-cache.js.map +1 -1
  6. package/lib/commonjs/defaults.js +9 -0
  7. package/lib/commonjs/defaults.js.map +1 -0
  8. package/lib/commonjs/dynamicLoading/dynamic-font-loading.js +8 -18
  9. package/lib/commonjs/dynamicLoading/dynamic-font-loading.js.map +1 -1
  10. package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js +19 -2
  11. package/lib/commonjs/dynamicLoading/dynamic-loading-setting.js.map +1 -1
  12. package/lib/commonjs/get-image-library.js +25 -5
  13. package/lib/commonjs/get-image-library.js.map +1 -1
  14. package/lib/commonjs/get-image-source.js +58 -0
  15. package/lib/commonjs/get-image-source.js.map +1 -0
  16. package/lib/commonjs/index.js +3 -2
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/commonjs/scripts/common.js.map +1 -1
  19. package/lib/commonjs/scripts/updatePlist.js.map +1 -1
  20. package/lib/module/create-icon-set.js +15 -57
  21. package/lib/module/create-icon-set.js.map +1 -1
  22. package/lib/module/create-icon-source-cache.js +0 -2
  23. package/lib/module/create-icon-source-cache.js.map +1 -1
  24. package/lib/module/defaults.js +5 -0
  25. package/lib/module/defaults.js.map +1 -0
  26. package/lib/module/dynamicLoading/dynamic-font-loading.js +10 -17
  27. package/lib/module/dynamicLoading/dynamic-font-loading.js.map +1 -1
  28. package/lib/module/dynamicLoading/dynamic-loading-setting.js +15 -1
  29. package/lib/module/dynamicLoading/dynamic-loading-setting.js.map +1 -1
  30. package/lib/module/get-image-library.js +26 -5
  31. package/lib/module/get-image-library.js.map +1 -1
  32. package/lib/module/get-image-source.js +52 -0
  33. package/lib/module/get-image-source.js.map +1 -0
  34. package/lib/module/index.js +3 -2
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/scripts/common.js.map +1 -1
  37. package/lib/module/scripts/updatePlist.js.map +1 -1
  38. package/lib/typescript/commonjs/src/create-icon-set.d.ts +0 -2
  39. package/lib/typescript/commonjs/src/create-icon-set.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/src/create-icon-source-cache.d.ts +0 -1
  41. package/lib/typescript/commonjs/src/create-icon-source-cache.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/src/defaults.d.ts +3 -0
  43. package/lib/typescript/commonjs/src/defaults.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts +33 -7
  46. package/lib/typescript/commonjs/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/src/get-image-library.d.ts +4 -1
  48. package/lib/typescript/commonjs/src/get-image-library.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/src/get-image-source.d.ts +11 -0
  50. package/lib/typescript/commonjs/src/get-image-source.d.ts.map +1 -0
  51. package/lib/typescript/commonjs/src/index.d.ts +4 -3
  52. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/scripts/common.d.ts.map +1 -1
  54. package/lib/typescript/module/src/create-icon-set.d.ts +0 -2
  55. package/lib/typescript/module/src/create-icon-set.d.ts.map +1 -1
  56. package/lib/typescript/module/src/create-icon-source-cache.d.ts +0 -1
  57. package/lib/typescript/module/src/create-icon-source-cache.d.ts.map +1 -1
  58. package/lib/typescript/module/src/defaults.d.ts +3 -0
  59. package/lib/typescript/module/src/defaults.d.ts.map +1 -0
  60. package/lib/typescript/module/src/dynamicLoading/dynamic-font-loading.d.ts.map +1 -1
  61. package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts +33 -7
  62. package/lib/typescript/module/src/dynamicLoading/dynamic-loading-setting.d.ts.map +1 -1
  63. package/lib/typescript/module/src/get-image-library.d.ts +4 -1
  64. package/lib/typescript/module/src/get-image-library.d.ts.map +1 -1
  65. package/lib/typescript/module/src/get-image-source.d.ts +11 -0
  66. package/lib/typescript/module/src/get-image-source.d.ts.map +1 -0
  67. package/lib/typescript/module/src/index.d.ts +4 -3
  68. package/lib/typescript/module/src/index.d.ts.map +1 -1
  69. package/lib/typescript/module/src/scripts/common.d.ts.map +1 -1
  70. package/package.json +3 -3
  71. package/src/create-icon-set.tsx +22 -76
  72. package/src/create-icon-source-cache.ts +1 -3
  73. package/src/defaults.ts +2 -0
  74. package/src/dynamicLoading/dynamic-font-loading.ts +12 -17
  75. package/src/dynamicLoading/dynamic-loading-setting.ts +65 -18
  76. package/src/get-image-library.ts +30 -9
  77. package/src/get-image-source.ts +74 -0
  78. package/src/index.ts +4 -3
  79. package/src/scripts/common.ts +1 -0
  80. package/src/scripts/updatePlist.ts +1 -0
package/README.md CHANGED
@@ -47,9 +47,9 @@ RNVI comes with the following supported icons. You can [search NPM](https://www.
47
47
  - [`Feather`](http://feathericons.com) created by Cole Bemis & Contributors (v4.29.2 featuring _287_ icons)
48
48
  - [`FontAwesome 6`](https://fontawesome.com/search) designed by Fonticons, Inc. (v6.7.2 featuring _2060_ free and _52663_ pro icons)
49
49
  - [`Foundation`](http://zurb.com/playground/foundation-icon-fonts-3) by ZURB, Inc. (v3.0 with _283_ icons)
50
- - [`Ionicons`](https://ionic.io/ionicons) crafted by Ionic (v7.4.0 containing _1356_ icons)
50
+ - [`Ionicons`](https://ionic.io/ionicons) crafted by Ionic (v8.0.9 containing _1357_ icons)
51
51
  - [`MaterialDesignIcons`](https://pictogrammers.com/library/mdi/) from MaterialDesignIcons.com (v7.4.47 including _7448_ icons)
52
- - [`Octicons`](https://primer.style/foundations/icons) designed by GitHub, Inc. (v19.15.0 with _333_ icons)
52
+ - [`Octicons`](https://primer.style/foundations/icons) designed by GitHub, Inc. (v19.15.2 with _333_ icons)
53
53
  - [`Lucide`](https://lucide.dev/) designed by Lucide, (v0.473.0 with _1548_ icons)
54
54
 
55
55
  ### No longer maintained upstream
@@ -69,14 +69,14 @@ See [MIGRATION.md](MIGRATION.md) if you are migrating from `react-native-vector-
69
69
 
70
70
  ## Installation
71
71
 
72
- 1. Install the packages for the icons you want use
72
+ 1. Install the packages for the icons you want to use
73
73
 
74
74
  ```sh
75
- npm install --save @react-native-vector-icons/fontawesome6 @react-native-vector-icons/evil-icons
75
+ npm install @react-native-vector-icons/fontawesome6 @react-native-vector-icons/evil-icons
76
76
  ```
77
77
 
78
- 2. Depending on the platform you're targeting (iOS/Android/Windows), follow the appropriate setup instructions below.
79
- 3. If you are using one of the following fonts refer to their guides for further instructions
78
+ 1. Depending on the platform you're targeting (iOS/Android/Windows), follow the appropriate setup instructions below.
79
+ 1. If you are using one of the following fonts, refer to their guides for further instructions
80
80
 
81
81
  - [FontAwesome 6](packages/fontawesome6/README.md)
82
82
  - [FontAwesome 6 Pro](packages/fontawesome6-pro/README.md)
@@ -89,13 +89,26 @@ See [MIGRATION.md](MIGRATION.md) if you are migrating from `react-native-vector-
89
89
 
90
90
  Please 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
+ ### Font location customisation
93
+
94
+ For fonts like fontawesome6-pro, fontello and icomoon where you provide the fonts the default location for the font files is `rnvi-fonts` in the same directory as your package.json. This can be customized by setting the `fontDir` property in your `package.json` file.
95
+
96
+ ```json
97
+ {
98
+ "reactNativeVectorIcons": {
99
+ "fontDir": "src/rnvi-fonts"
100
+ }
101
+ }
102
+ ```
103
+
92
104
  ## `Icon` Component
93
105
 
94
106
  You can either use one of the bundled icons above or roll your own custom font.
95
107
 
96
108
  ```js
97
- import Icon from '@react-native-vector-icons/fontawesome';
98
- const myIcon = <Icon name="rocket" size={30} color="#900" />;
109
+ import Icon from "@react-native-vector-icons/fontawesome";
110
+
111
+ <Icon name="rocket" size={30} color="#900" />;
99
112
  ```
100
113
 
101
114
  ### Props
@@ -128,14 +141,16 @@ By combining some of these you can create for example :
128
141
 
129
142
  ## Multi-Style Fonts
130
143
 
131
- Some fonts today use multiple styles, FontAwesome 5 for example, which is supported by this library. The usage is pretty much the same as the standard `Icon` component:
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:
132
145
 
133
146
  ```jsx
134
- import Icon from '@react-native-vector-icons/fontawesome5';
147
+ import Icon from "@react-native-vector-icons/fontawesome5";
148
+
149
+ <Icon name="comments" size={30} color="#900" />; // Defaults to regular
135
150
 
136
- const myIcon1 = <Icon name="comments" size={30} color="#900" />; // Defaults to solid
137
- const myIcon2 = <Icon name="comments" size={30} color="#900" iconType="solid" />;
138
- const myIcon3 = <Icon name="comments" size={30} color="#900" iconType="light" />; // Only in FA5 Pro
151
+ <Icon name="comments" size={30} color="#900" iconType="solid" />
152
+
153
+ <Icon name="comments" size={30} color="#900" iconType="light" />
139
154
  ```
140
155
 
141
156
  ## Usage as PNG Image/Source Object
@@ -146,6 +161,7 @@ You need to install `@react-native-vector-icons/get-image` to use this feature.
146
161
 
147
162
  ```jsx
148
163
  const source = Icon.getImageSourceSync('user', 20, 'red');
164
+
149
165
  return <Image source={source} />;
150
166
  );
151
167
  ```
@@ -176,16 +192,16 @@ name and the value is either a UTF-8 character or it's character code.
176
192
  Font Book.app or similar to learn the name. Also pass the `fontFileName` argument for Android support.
177
193
 
178
194
  ```js
179
- import { createIconSet } from '@react-native-vector-icons/common';
180
- const glyphMap = { 'icon-name': 1234, test: '' };
195
+ import { createIconSet } from "@react-native-vector-icons/common";
196
+ const glyphMap = { "icon-name": 1234, test: "" };
181
197
 
182
198
  // use createIconSet() with object parameter
183
199
  // or use positional parameters for compatibility with version <= 10: `createIconSet(glyphMap, fontFamily[, fontFile])`
184
200
  const Icon = createIconSet(glyphMap, {
185
- postScriptName: 'FontName',
186
- fontFileName: 'font-name.ttf',
187
- fontSource: require('../fonts/font-name.ttf') // optional, for dynamic loading. Can also be a local file uri.
188
- })
201
+ postScriptName: "FontName",
202
+ fontFileName: "font-name.ttf",
203
+ fontSource: require("../fonts/font-name.ttf"), // optional, for dynamic loading. Can also be a local file uri.
204
+ });
189
205
  ```
190
206
 
191
207
  If you aren't using dynamic font loading you need to make sure your font is copied into your bundle.
@@ -201,13 +217,13 @@ animation library
201
217
 
202
218
  ## Dynamic icon font loading
203
219
 
204
- > At the moment, dynamic loading is supported on native platforms (not on web) only if you use Expo. In the future, it should become available for all React Native projects via React Native core.
220
+ > At the moment, dynamic loading is supported on native platforms (not on web) only 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.
205
221
 
206
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.
207
223
 
208
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: see any of the free font packages for reference.
209
225
 
210
- By default, dynamic loading is enabled if supported by the version of Expo that you're using. 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.
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.
211
227
 
212
228
  `@react-native-vector-icons/common` exports several functions which you can use to control dynamic loading:
213
229
 
@@ -227,26 +243,22 @@ Try the `IconExplorer` project in `Examples/IconExplorer` folder, there you can
227
243
  ### Basic Example
228
244
 
229
245
  ```js
230
- import Icon from '@react-native-vector-icons/ionicons';
246
+ import Icon from "@react-native-vector-icons/ionicons";
231
247
 
232
- function ExampleView(props) {
233
- return <Icon name="ios-person" size={30} color="#4F8EF7" />;
234
- }
248
+ const ExampleView = () => <Icon name="ios-person" size={30} color="#4F8EF7" />;
235
249
  ```
236
250
 
237
251
  ### Inline Icons
238
252
 
239
253
  ```js
240
- import { Text } from 'react-native';
241
- import Icon from '@react-native-vector-icons/ionicons';
242
-
243
- function ExampleView(props) {
244
- return (
245
- <Text>
246
- Lorem <Icon name="ios-book" color="#4F8EF7" /> Ipsum
247
- </Text>
248
- );
249
- }
254
+ import { Text } from "react-native";
255
+ import Icon from "@react-native-vector-icons/ionicons";
256
+
257
+ const ExampleView = (props) => (
258
+ <Text>
259
+ Lorem <Icon name="ios-book" color="#4F8EF7" /> Ipsum
260
+ </Text>
261
+ );
250
262
  ```
251
263
 
252
264
  ## Testing
@@ -273,11 +285,11 @@ Create `__mocks__/@react-native-vector-icons/common.js`:
273
285
  ```js
274
286
  // Mock the entire common library so there are no native module loading errors
275
287
  module.exports = {
276
- createIconSet: () => "icon"
277
- }
288
+ createIconSet: () => "icon",
289
+ };
278
290
  ```
279
291
 
280
- ## [Changelog](https://github.com/react-native-vector-icons/react-native-vector-icons/releases)
292
+ ## [Changelog](https://github.com/oblador/react-native-vector-icons/releases)
281
293
 
282
294
  ## License
283
295
 
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DEFAULT_ICON_SIZE = exports.DEFAULT_ICON_COLOR = void 0;
7
6
  exports.createIconSet = createIconSet;
8
7
  var _react = _interopRequireWildcard(require("react"));
9
8
  var _reactNative = require("react-native");
10
9
  var _createIconSourceCache = _interopRequireDefault(require("./create-icon-source-cache.js"));
10
+ var _defaults = require("./defaults.js");
11
11
  var _dynamicFontLoading = require("./dynamicLoading/dynamic-font-loading");
12
12
  var _dynamicLoadingSetting = require("./dynamicLoading/dynamic-loading-setting.js");
13
- var _getImageLibrary = require("./get-image-library.js");
13
+ var _getImageSource = require("./get-image-source.js");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -19,8 +19,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
19
 
20
20
  // eslint-disable-next-line import/no-extraneous-dependencies
21
21
 
22
- const DEFAULT_ICON_SIZE = exports.DEFAULT_ICON_SIZE = 12;
23
- const DEFAULT_ICON_COLOR = exports.DEFAULT_ICON_COLOR = 'black';
24
22
  function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNameParam, fontStyleParam) {
25
23
  const {
26
24
  postScriptName,
@@ -35,20 +33,24 @@ function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNameParam, fon
35
33
  const fontReference = _reactNative.Platform.select({
36
34
  windows: `/Assets/${fontFileName}#${postScriptName}`,
37
35
  android: fontBasename,
38
- web: fontBasename,
39
36
  default: postScriptName
40
37
  });
38
+ const styleOverrides = {
39
+ fontFamily: fontReference,
40
+ fontWeight: 'normal',
41
+ fontStyle: 'normal'
42
+ };
41
43
  const resolveGlyph = name => {
42
- const glyph = glyphMap[name] || '?';
44
+ const glyph = glyphMap[name];
43
45
  if (typeof glyph === 'number') {
44
46
  return String.fromCodePoint(glyph);
45
47
  }
46
- return glyph;
48
+ return '?';
47
49
  };
48
50
  const Icon = ({
49
51
  name,
50
- size = DEFAULT_ICON_SIZE,
51
- color = DEFAULT_ICON_COLOR,
52
+ size = _defaults.DEFAULT_ICON_SIZE,
53
+ color = _defaults.DEFAULT_ICON_COLOR,
52
54
  style,
53
55
  children,
54
56
  allowFontScaling = false,
@@ -76,11 +78,6 @@ function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNameParam, fon
76
78
  fontSize: size,
77
79
  color
78
80
  };
79
- const styleOverrides = {
80
- fontFamily: fontReference,
81
- fontWeight: 'normal',
82
- fontStyle: 'normal'
83
- };
84
81
  const newProps = {
85
82
  ...props,
86
83
  style: [styleDefaults, style, styleOverrides, fontStyle || {}],
@@ -99,52 +96,13 @@ function createIconSet(glyphMap, postScriptNameOrOptions, fontFileNameParam, fon
99
96
  }));
100
97
  WrappedIcon.displayName = 'Icon';
101
98
  const imageSourceCache = (0, _createIconSourceCache.default)();
102
- const getImageSourceSync = (name, size = DEFAULT_ICON_SIZE, color = DEFAULT_ICON_COLOR) => {
103
- const NativeIconAPI = (0, _getImageLibrary.ensureGetImageAvailable)();
104
- const glyph = resolveGlyph(name);
105
- const processedColor = (0, _reactNative.processColor)(color);
106
- const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
107
- if (imageSourceCache.has(cacheKey)) {
108
- // FIXME: Should this check if it's an error and throw it again?
109
- return imageSourceCache.get(cacheKey);
110
- }
111
- try {
112
- const imagePath = NativeIconAPI.getImageForFontSync(fontReference, glyph, size, processedColor // FIXME what if a non existant colour was passed in?
113
- );
114
- const value = {
115
- uri: imagePath,
116
- scale: _reactNative.PixelRatio.get()
117
- };
118
- imageSourceCache.setValue(cacheKey, value);
119
- return value;
120
- } catch (error) {
121
- imageSourceCache.setError(cacheKey, error);
122
- throw error;
123
- }
124
- };
125
- const getImageSource = async (name, size = DEFAULT_ICON_SIZE, color = DEFAULT_ICON_COLOR) => {
126
- const NativeIconAPI = (0, _getImageLibrary.ensureGetImageAvailable)();
127
- const glyph = resolveGlyph(name);
128
- const processedColor = (0, _reactNative.processColor)(color);
129
- const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
130
- if (imageSourceCache.has(cacheKey)) {
131
- // FIXME: Should this check if it's an error and throw it again?
132
- return imageSourceCache.get(cacheKey);
133
- }
134
- try {
135
- const imagePath = await NativeIconAPI.getImageForFont(fontReference, glyph, size, processedColor // FIXME what if a non existant colour was passed in?
136
- );
137
- const value = {
138
- uri: imagePath,
139
- scale: _reactNative.PixelRatio.get()
140
- };
141
- imageSourceCache.setValue(cacheKey, value);
142
- return value;
143
- } catch (error) {
144
- imageSourceCache.setError(cacheKey, error);
145
- throw error;
99
+ const getImageSource = async (name, size, color) => {
100
+ if (typeof postScriptNameOrOptions === 'object' && typeof postScriptNameOrOptions.fontSource !== 'undefined') {
101
+ await _dynamicFontLoading.dynamicLoader.loadFontAsync(fontReference, postScriptNameOrOptions.fontSource);
146
102
  }
103
+ return (0, _getImageSource.getImageSource)(imageSourceCache, fontReference, resolveGlyph(name), size, color);
147
104
  };
105
+ const getImageSourceSync = (name, size, color) => (0, _getImageSource.getImageSourceSync)(imageSourceCache, fontReference, resolveGlyph(name), size, color);
148
106
  const IconNamespace = Object.assign(WrappedIcon, {
149
107
  getImageSource,
150
108
  getImageSourceSync
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createIconSourceCache","_interopRequireDefault","_dynamicFontLoading","_dynamicLoadingSetting","_getImageLibrary","_jsxRuntime","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_ICON_SIZE","exports","DEFAULT_ICON_COLOR","createIconSet","glyphMap","postScriptNameOrOptions","fontFileNameParam","fontStyleParam","postScriptName","fontFileName","fontStyle","fontBasename","replace","fontReference","Platform","select","windows","android","web","resolveGlyph","name","glyph","String","fromCodePoint","Icon","size","color","style","children","allowFontScaling","innerRef","props","isFontLoaded","setIsFontLoaded","React","useState","isDynamicLoadingEnabled","dynamicLoader","isLoaded","useEffect","isMounted","fontSource","loadFontAsync","finally","styleDefaults","fontSize","styleOverrides","fontFamily","fontWeight","newProps","jsxs","Text","ref","selectable","WrappedIcon","forwardRef","jsx","displayName","imageSourceCache","createIconSourceCache","getImageSourceSync","NativeIconAPI","ensureGetImageAvailable","processedColor","processColor","cacheKey","imagePath","getImageForFontSync","value","uri","scale","PixelRatio","setValue","error","setError","getImageSource","getImageForFont","IconNamespace","assign"],"sourceRoot":"../../src","sources":["create-icon-set.tsx"],"mapp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AE;IAC/CqB,cAAc;IACdf;EACF,CAAC,CAAC;EAEF,OAAOiB,aAAa;AACtB","ignoreList":[]}
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,C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OxB,uBAAuB,KAAK,QAAQ,IAAI,OAAOA,uBAAuB,CAACwC,UAAU,KAAK,WAAW,EAAE;MAC5G,MAAMJ,iCAAa,CAACK,aAAa,CAACjC,aAAa,EAAER,uBAAuB,CAACwC,UAAU,CAAC;IACtF;IACA,OAAO,IAAAiB,8BAAkB,EAACH,gBAAgB,EAAE9C,aAAa,EAAEQ,YAAY,CAACC,IAAI,CAAC,EAAEK,IAAI,EAAEE,KAAK,CAAC;EAC7F,CAAC;EAED,MAAMkC,kBAAwD,GAAGA,CAACzC,IAAI,EAAEK,IAAI,EAAEE,KAAK,KACjF,IAAAmC,kCAAsB,EAACL,gBAAgB,EAAE9C,aAAa,EAAEQ,YAAY,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":[]}
@@ -16,7 +16,6 @@ function createIconSourceCache() {
16
16
  type: TYPE_ERROR,
17
17
  data: error
18
18
  });
19
- const has = key => cache.has(key);
20
19
  const get = key => {
21
20
  const value = cache.get(key);
22
21
  if (!value) {
@@ -34,7 +33,6 @@ function createIconSourceCache() {
34
33
  return {
35
34
  setValue,
36
35
  setError,
37
- has,
38
36
  get
39
37
  };
40
38
  }
@@ -1 +1 @@
1
- {"version":3,"names":["TYPE_VALUE","TYPE_ERROR","createIconSourceCache","cache","Map","setValue","key","value","set","type","data","setError","error","has","get","undefined"],"sourceRoot":"../../src","sources":["create-icon-source-cache.ts"],"mappings":";;;;;;AAAA,MAAMA,UAAU,GAAG,OAAO;AAC1B,MAAMC,UAAU,GAAG,OAAO;AAMX,SAASC,qBAAqBA,CAAA,EAAG;EAC9C,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAgB,CAAC;EAEtC,MAAMC,QAAQ,GAAGA,CAACC,GAAW,EAAEC,KAAgB,KAAKJ,KAAK,CAACK,GAAG,CAACF,GAAG,EAAE;IAAEG,IAAI,EAAET,UAAU;IAAEU,IAAI,EAAEH;EAAM,CAAC,CAAC;EAErG,MAAMI,QAAQ,GAAGA,CAACL,GAAW,EAAEM,KAAY,KAAKT,KAAK,CAACK,GAAG,CAACF,GAAG,EAAE;IAAEG,IAAI,EAAER,UAAU;IAAES,IAAI,EAAEE;EAAM,CAAC,CAAC;EAEjG,MAAMC,GAAG,GAAIP,GAAW,IAAKH,KAAK,CAACU,GAAG,CAACP,GAAG,CAAC;EAE3C,MAAMQ,GAAG,GAAIR,GAAW,IAAK;IAC3B,MAAMC,KAAK,GAAGJ,KAAK,CAACW,GAAG,CAACR,GAAG,CAAC;IAC5B,IAAI,CAACC,KAAK,EAAE;MACV,OAAOQ,SAAS;IAClB;IAEA,MAAM;MAAEN,IAAI;MAAEC;IAAK,CAAC,GAAGH,KAAK;IAC5B,IAAIE,IAAI,KAAKR,UAAU,EAAE;MACvB,MAAMS,IAAI;IACZ;IACA,OAAOA,IAAI;EACb,CAAC;EAED,OAAO;IAAEL,QAAQ;IAAEM,QAAQ;IAAEE,GAAG;IAAEC;EAAI,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["TYPE_VALUE","TYPE_ERROR","createIconSourceCache","cache","Map","setValue","key","value","set","type","data","setError","error","get","undefined"],"sourceRoot":"../../src","sources":["create-icon-source-cache.ts"],"mappings":";;;;;;AAAA,MAAMA,UAAU,GAAG,OAAO;AAC1B,MAAMC,UAAU,GAAG,OAAO;AAMX,SAASC,qBAAqBA,CAAA,EAAG;EAC9C,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAgB,CAAC;EAEtC,MAAMC,QAAQ,GAAGA,CAACC,GAAW,EAAEC,KAAgB,KAAKJ,KAAK,CAACK,GAAG,CAACF,GAAG,EAAE;IAAEG,IAAI,EAAET,UAAU;IAAEU,IAAI,EAAEH;EAAM,CAAC,CAAC;EAErG,MAAMI,QAAQ,GAAGA,CAACL,GAAW,EAAEM,KAAY,KAAKT,KAAK,CAACK,GAAG,CAACF,GAAG,EAAE;IAAEG,IAAI,EAAER,UAAU;IAAES,IAAI,EAAEE;EAAM,CAAC,CAAC;EAEjG,MAAMC,GAAG,GAAIP,GAAW,IAAK;IAC3B,MAAMC,KAAK,GAAGJ,KAAK,CAACU,GAAG,CAACP,GAAG,CAAC;IAC5B,IAAI,CAACC,KAAK,EAAE;MACV,OAAOO,SAAS;IAClB;IAEA,MAAM;MAAEL,IAAI;MAAEC;IAAK,CAAC,GAAGH,KAAK;IAC5B,IAAIE,IAAI,KAAKR,UAAU,EAAE;MACvB,MAAMS,IAAI;IACZ;IACA,OAAOA,IAAI;EACb,CAAC;EAED,OAAO;IAAEL,QAAQ;IAAEM,QAAQ;IAAEE;EAAI,CAAC;AACpC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_ICON_SIZE = exports.DEFAULT_ICON_COLOR = void 0;
7
+ const DEFAULT_ICON_SIZE = exports.DEFAULT_ICON_SIZE = 12;
8
+ const DEFAULT_ICON_COLOR = exports.DEFAULT_ICON_COLOR = 'black';
9
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_ICON_SIZE","exports","DEFAULT_ICON_COLOR"],"sourceRoot":"../../src","sources":["defaults.ts"],"mappings":";;;;;;AAAO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,EAAE;AAC5B,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,OAAO","ignoreList":[]}
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.dynamicLoader = void 0;
7
+ var _reactNative = require("react-native");
7
8
  var _registry = require("@react-native/assets-registry/registry");
8
- var _resolveAssetSource = _interopRequireDefault(require("react-native/Libraries/Image/resolveAssetSource"));
9
9
  var _dynamicLoadingSetting = require("./dynamic-loading-setting.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
10
  /*
12
11
  * The following imports are always present when react native is installed
13
12
  * in the future, more explicit apis will be exposed by the core, including typings
@@ -15,15 +14,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
14
  // @ts-expect-error missing types
16
15
  // eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
17
16
 
18
- // @ts-expect-error missing types
19
- // eslint-disable-next-line import/no-extraneous-dependencies
20
-
21
17
  const loadPromises = {};
22
18
  const loadFontAsync = async (fontFamily, fontSource) => {
23
- const expoModules = globalThis?.expo?.modules;
24
- if (!expoModules) {
25
- throw new Error('Expo is not available. Dynamic font loading is not available.');
26
- }
19
+ const globalRef = globalThis;
20
+ (0, _dynamicLoadingSetting.assertExpoModulesPresent)(globalRef);
21
+ const expoModules = globalRef.expo.modules;
27
22
  if (loadPromises[fontFamily]) {
28
23
  return loadPromises[fontFamily];
29
24
  }
@@ -62,8 +57,7 @@ const getLocalFontUrl = (fontModuleId, fontFamily) => {
62
57
  if (!assetMeta) {
63
58
  throw new Error(`no asset found for font family "${fontFamily}", moduleId: ${String(fontModuleId)}`);
64
59
  }
65
- const resolver = _resolveAssetSource.default;
66
- const assetSource = resolver(fontModuleId);
60
+ const assetSource = _reactNative.Image.resolveAssetSource(fontModuleId);
67
61
  return {
68
62
  ...assetMeta,
69
63
  ...assetSource
@@ -74,13 +68,9 @@ const isLoadedNative = fontFamily => {
74
68
  if (fontFamily in loadedFontsCache) {
75
69
  return true;
76
70
  }
77
- const {
78
- expo
79
- } = globalThis;
80
- if (!expo) {
81
- throw new Error('Expo is not available. Dynamic font loading is not available.');
82
- }
83
- const loadedNativeFonts = expo.modules.ExpoFontLoader.getLoadedFonts();
71
+ const globalRef = globalThis;
72
+ (0, _dynamicLoadingSetting.assertExpoModulesPresent)(globalRef);
73
+ const loadedNativeFonts = globalRef.expo.modules.ExpoFontLoader.getLoadedFonts();
84
74
  loadedNativeFonts.forEach(font => {
85
75
  loadedFontsCache[font] = true;
86
76
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_registry","require","_resolveAssetSource","_interopRequireDefault","_dynamicLoadingSetting","e","__esModule","default","loadPromises","loadFontAsync","fontFamily","fontSource","expoModules","globalThis","expo","modules","Error","LoadFont","localUri","uri","type","hash","getLocalFontUrl","ExpoAsset","downloadAsync","ExpoFontLoader","loadAsync","error","console","getErrorCallback","fontModuleId","assetMeta","getAssetByID","String","resolver","resolveAssetSource","assetSource","loadedFontsCache","isLoadedNative","loadedNativeFonts","getLoadedFonts","forEach","font","dynamicLoader","exports","isLoaded"],"sourceRoot":"../../../src","sources":["dynamicLoading/dynamic-font-loading.ts"],"mappings":";;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AAA6D,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAX7D;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;;AAKA,MAAMG,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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UAAU,IAAI2B,gBAAgB,EAAE;IAClC,OAAO,IAAI;EACb;EAEA,MAAM;IAAEvB;EAAK,CAAC,GAAGD,UAAU;EAC3B,IAAI,CAACC,IAAI,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,+DAA+D,CAAC;EAClF;EAEA,MAAMuB,iBAAiB,GAAGzB,IAAI,CAACC,OAAO,CAACU,cAAc,CAACe,cAAc,CAAC,CAAC;EACtED,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAOhC,UAAU,IAAI2B,gBAAgB;AACvC,CAAC;AAEM,MAAMM,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CE,QAAQ,EAAEP,cAAc;EACxB7B;AACF,CAAC","ignoreList":[]}
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":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAMA,MAAMG,YAAqD,GAAG,CAAC,CAAC;AAEhE,MAAMC,aAAa,GAAG,MAAAA,CAAOC,UAAkB,EAAEC,UAAsB,KAAoB;EACzF,MAAMC,SAAS,GAAGC,UAAU;EAC5B,IAAAC,+CAAwB,EAACF,SAAS,CAA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,EAAE,CAAC;EACtG;EAEA,MAAMK,WAAW,GAAGC,kBAAK,CAACC,kBAAkB,CAACP,YAAY,CAAC;EAE1D,OAAO;IAAE,GAAGC,SAAS;IAAE,GAAGI;EAAY,CAAC;AACzC,CAAC;AAED,MAAMG,gBAA6C,GAAG,CAAC,CAAC;AAExD,MAAMC,cAAc,GAAI9B,UAAkB,IAAK;EAC7C,IAAIA,UAAU,IAAI6B,gBAAgB,EAAE;IAClC,OAAO,IAAI;EACb;EACA,MAAM3B,SAAS,GAAGC,UAAU;EAC5B,IAAAC,+CAAwB,EAACF,SAAS,CAAC;EAEnC,MAAM6B,iBAAiB,GAAG7B,SAAS,CAACI,IAAI,CAACC,OAAO,CAACS,cAAc,CAACgB,cAAc,CAAC,CAAC;EAChFD,iBAAiB,CAACE,OAAO,CAAEC,IAAI,IAAK;IAClCL,gBAAgB,CAACK,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EAEF,OAAOlC,UAAU,IAAI6B,gBAAgB;AACvC,CAAC;AAEM,MAAMM,aAA4B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC1CE,QAAQ,EAAEP,cAAc;EACxB/B;AACF,CAAC","ignoreList":[]}
@@ -3,9 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setDynamicLoadingErrorCallback = exports.setDynamicLoadingEnabled = exports.isDynamicLoadingSupported = exports.isDynamicLoadingEnabled = exports.getErrorCallback = void 0;
6
+ exports.assertExpoModulesPresent = assertExpoModulesPresent;
7
+ exports.getErrorCallback = void 0;
8
+ exports.getIsRenderToImageSupported = getIsRenderToImageSupported;
9
+ exports.setDynamicLoadingErrorCallback = exports.setDynamicLoadingEnabled = exports.isDynamicLoadingSupported = exports.isDynamicLoadingEnabled = void 0;
10
+ // biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
11
+ 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';
13
+ }
14
+
15
+ // biome-ignore lint/suspicious/noExplicitAny: this is used internally with globalThis
16
+ function getIsRenderToImageSupported(globalObj) {
17
+ return globalObj?.expo && typeof globalObj.expo.modules?.ExpoFontUtils?.renderToImageAsync === 'function';
18
+ }
19
+ function assertExpoModulesPresent(globalObj) {
20
+ if (!getIsDynamicLoadingSupported(globalObj)) {
21
+ throw new Error('Dynamic font loading for Expo is not available.');
22
+ }
23
+ }
7
24
  const hasNecessaryExpoModules = !!globalThis.expo?.modules?.ExpoAsset && !!globalThis.expo?.modules?.ExpoFontLoader;
8
- const hasNecessaryExpoFeatures = hasNecessaryExpoModules && typeof globalThis.expo?.modules.ExpoFontLoader.getLoadedFonts === 'function';
25
+ const hasNecessaryExpoFeatures = getIsDynamicLoadingSupported(globalThis);
9
26
  let dynamicFontLoadingEnabled = hasNecessaryExpoFeatures;
10
27
  const isDynamicLoadingSupported = () => hasNecessaryExpoFeatures;
11
28
 
@@ -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","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":";;;;;;;;;AA8CA;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;AACO,SAASC,2BAA2BA,CAACR,SAAc,EAMxD;EACA,OAAOA,SAAS,EAAEC,IAAI,IAAI,OAAOD,SAAS,CAACC,IAAI,CAACC,OAAO,EAAEO,aAAa,EAAEC,kBAAkB,KAAK,UAAU;AAC3G;AAEO,SAASC,wBAAwBA,CAACX,SAAkB,EAAiD;EAC1G,IAAI,CAACD,4BAA4B,CAACC,SAAS,CAAC,EAAE;IAC5C,MAAM,IAAIY,KAAK,CAAC,iDAAiD,CAAC;EACpE;AACF;AAEA,MAAMC,uBAAuB,GAAG,CAAC,CAACC,UAAU,CAACb,IAAI,EAAEC,OAAO,EAAEC,SAAS,IAAI,CAAC,CAACW,UAAU,CAACb,IAAI,EAAEC,OAAO,EAAEG,cAAc;AAEnH,MAAMU,wBAAwB,GAAGhB,4BAA4B,CAACe,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;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":[]}
@@ -4,20 +4,40 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ensureGetImageAvailable = void 0;
7
+ var _dynamicLoadingSetting = require("./dynamicLoading/dynamic-loading-setting.js");
7
8
  // eslint-disable-next-line import/no-mutable-exports
8
9
  let NativeIconAPI = null;
9
10
  try {
10
11
  // eslint-disable-next-line global-require,import/no-extraneous-dependencies,@typescript-eslint/no-require-imports
11
12
  NativeIconAPI = require('@react-native-vector-icons/get-image');
12
13
  } catch {
13
- // No warning at this stage
14
+ // if this fails, it's likely due to:
15
+ // "Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'VectorIcons' could not be found. ..."
16
+ // No warning at this stage.
14
17
  }
18
+ const globalRef = globalThis;
19
+ const hasExpoRenderToImage = (0, _dynamicLoadingSetting.getIsRenderToImageSupported)(globalRef);
15
20
  const ensureGetImageAvailable = () => {
16
- if (!NativeIconAPI) {
17
- throw new Error('Could not import @react-native-vector-icons/get-image, did you install it? It is required for getImageSource*');
21
+ if (NativeIconAPI) {
22
+ NativeIconAPI.ensureNativeModuleAvailable();
23
+ return NativeIconAPI;
18
24
  }
19
- NativeIconAPI.ensureNativeModuleAvailable();
20
- return NativeIconAPI;
25
+ if (hasExpoRenderToImage) {
26
+ const {
27
+ ExpoFontUtils
28
+ } = globalRef.expo.modules;
29
+ return {
30
+ getImageForFont: async (fontReference, glyph, size, color) => ExpoFontUtils.renderToImageAsync(glyph, {
31
+ fontFamily: fontReference,
32
+ size,
33
+ color
34
+ }),
35
+ getImageForFontSync: () => {
36
+ throw new Error('You attempted to call `getImageForFontSync`. Expo dev client with `@react-native-vector-icons/get-image` installed is required for this. Alternatively, call `getImageForFont` or generate the image yourself and bundle it with the app.');
37
+ }
38
+ };
39
+ }
40
+ throw new Error('Error in getImageSource / getImageSourceSync: You need to either (1) install `@react-native-vector-icons/get-image` or (2) use Expo SDK 53+ (Expo dev client or Expo Go). Check your setup and rebuild the app.');
21
41
  };
22
42
  exports.ensureGetImageAvailable = ensureGetImageAvailable;
23
43
  //# sourceMappingURL=get-image-library.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeIconAPI","require","ensureGetImageAvailable","Error","ensureNativeModuleAvailable","exports"],"sourceRoot":"../../src","sources":["get-image-library.ts"],"mappings":";;;;;;AAAA;AACA,IAAIA,aAA2E,GAAG,IAAI;AAEtF,IAAI;EACF;EACAA,aAAa,GAAGC,OAAO,CAAC,sCAAsC,CAAC;AACjE,CAAC,CAAC,MAAM;EACN;AAAA;AAGK,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAI,CAACF,aAAa,EAAE;IAClB,MAAM,IAAIG,KAAK,CACb,+GACF,CAAC;EACH;EAEAH,aAAa,CAACI,2BAA2B,CAAC,CAAC;EAE3C,OAAOJ,aAAa;AACtB,CAAC;AAACK,OAAA,CAAAH,uBAAA,GAAAA,uBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_dynamicLoadingSetting","require","NativeIconAPI","globalRef","globalThis","hasExpoRenderToImage","getIsRenderToImageSupported","ensureGetImageAvailable","ensureNativeModuleAvailable","ExpoFontUtils","expo","modules","getImageForFont","fontReference","glyph","size","color","renderToImageAsync","fontFamily","getImageForFontSync","Error","exports"],"sourceRoot":"../../src","sources":["get-image-library.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA;AACA,IAAIC,aAA2E,GAAG,IAAI;AAEtF,IAAI;EACF;EACAA,aAAa,GAAGD,OAAO,CAAC,sCAAsC,CAAC;AACjE,CAAC,CAAC,MAAM;EACN;EACA;EACA;AAAA;AAGF,MAAME,SAAS,GAAGC,UAAU;AAC5B,MAAMC,oBAAoB,GAAG,IAAAC,kDAA2B,EAACH,SAAS,CAAC;AAE5D,MAAMI,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,IAAIL,aAAa,EAAE;IACjBA,aAAa,CAACM,2BAA2B,CAAC,CAAC;IAC3C,OAAON,aAAa;EACtB;EACA,IAAIG,oBAAoB,EAAE;IACxB,MAAM;MAAEI;IAAc,CAAC,GAAGN,SAAS,CAACO,IAAI,CAACC,OAAO;IAChD,OAAO;MACLC,eAAe,EAAE,MAAAA,CAAOC,aAAqB,EAAEC,KAAa,EAAEC,IAAY,EAAEC,KAAa,KACvFP,aAAa,CAACQ,kBAAkB,CAACH,KAAK,EAAE;QACtCI,UAAU,EAAEL,aAAa;QACzBE,IAAI;QACJC;MACF,CAAC,CAAC;MACJG,mBAAmB,EAAEA,CAAA,KAAM;QACzB,MAAM,IAAIC,KAAK,CACb,2OACF,CAAC;MACH;IACF,CAAC;EACH;EACA,MAAM,IAAIA,KAAK,CACb,iNACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAAd,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getImageSourceSync = exports.getImageSource = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _defaults = require("./defaults.js");
9
+ var _getImageLibrary = require("./get-image-library.js");
10
+ const getImageSourceSync = (imageSourceCache, fontReference, glyph, size = _defaults.DEFAULT_ICON_SIZE, color = _defaults.DEFAULT_ICON_COLOR) => {
11
+ const NativeIconAPI = (0, _getImageLibrary.ensureGetImageAvailable)();
12
+ const processedColor = (0, _reactNative.processColor)(color);
13
+ const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
14
+ const maybeCachedValue = imageSourceCache.get(cacheKey);
15
+ if (maybeCachedValue !== undefined) {
16
+ // FIXME: Should this check if it's an error and throw it again?
17
+ return maybeCachedValue;
18
+ }
19
+ try {
20
+ const imagePath = NativeIconAPI.getImageForFontSync(fontReference, glyph, size, processedColor // FIXME what if a non existent colour was passed in?
21
+ );
22
+ const value = {
23
+ uri: imagePath,
24
+ scale: _reactNative.PixelRatio.get()
25
+ };
26
+ imageSourceCache.setValue(cacheKey, value);
27
+ return value;
28
+ } catch (error) {
29
+ imageSourceCache.setError(cacheKey, error);
30
+ throw error;
31
+ }
32
+ };
33
+ exports.getImageSourceSync = getImageSourceSync;
34
+ const getImageSource = async (imageSourceCache, fontReference, glyph, size = _defaults.DEFAULT_ICON_SIZE, color = _defaults.DEFAULT_ICON_COLOR) => {
35
+ const NativeIconAPI = (0, _getImageLibrary.ensureGetImageAvailable)();
36
+ const processedColor = (0, _reactNative.processColor)(color);
37
+ const cacheKey = `${glyph}:${size}:${String(processedColor)}`;
38
+ const maybeCachedValue = imageSourceCache.get(cacheKey);
39
+ if (maybeCachedValue !== undefined) {
40
+ // FIXME: Should this check if it's an error and throw it again?
41
+ return maybeCachedValue;
42
+ }
43
+ try {
44
+ const imagePath = await NativeIconAPI.getImageForFont(fontReference, glyph, size, processedColor // FIXME what if a non existent colour was passed in?
45
+ );
46
+ const value = {
47
+ uri: imagePath,
48
+ scale: _reactNative.PixelRatio.get()
49
+ };
50
+ imageSourceCache.setValue(cacheKey, value);
51
+ return value;
52
+ } catch (error) {
53
+ imageSourceCache.setError(cacheKey, error);
54
+ throw error;
55
+ }
56
+ };
57
+ exports.getImageSource = getImageSource;
58
+ //# sourceMappingURL=get-image-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_defaults","_getImageLibrary","getImageSourceSync","imageSourceCache","fontReference","glyph","size","DEFAULT_ICON_SIZE","color","DEFAULT_ICON_COLOR","NativeIconAPI","ensureGetImageAvailable","processedColor","processColor","cacheKey","String","maybeCachedValue","get","undefined","imagePath","getImageForFontSync","value","uri","scale","PixelRatio","setValue","error","setError","exports","getImageSource","getImageForFont"],"sourceRoot":"../../src","sources":["get-image-source.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,GAAGA,CAChCC,gBAA0D,EAC1DC,aAAqB,EACrBC,KAAa,EACbC,IAAI,GAAGC,2BAAiB,EACxBC,KAAyB,GAAGC,4BAAkB,KAC3C;EACH,MAAMC,aAAa,GAAG,IAAAC,wCAAuB,EAAC,CAAC;EAE/C,MAAMC,cAAc,GAAG,IAAAC,yBAAY,EAACL,KAAK,CAAC;EAC1C,MAAMM,QAAQ,GAAG,GAAGT,KAAK,IAAIC,IAAI,IAAIS,MAAM,CAACH,cAAc,CAAC,EAAE;EAE7D,MAAMI,gBAAgB,GAAGb,gBAAgB,CAACc,GAAG,CAACH,QAAQ,CAAC;EACvD,IAAIE,gBAAgB,KAAKE,SAAS,EAAE;IAClC;IACA,OAAOF,gBAAgB;EACzB;EAEA,IAAI;IACF,MAAMG,SAAS,GAAGT,aAAa,CAACU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