rn-iconify 3.0.0 → 3.0.2

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.
@@ -15,6 +15,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
15
15
 
16
16
  /**
17
17
  * MMKV storage interface (compatible with both v3 and v4)
18
+ * v3.x uses `delete(key)`, v4.x uses `remove(key)`
18
19
  */
19
20
 
20
21
  /**
@@ -28,15 +29,18 @@ function createStorage(id) {
28
29
  id
29
30
  };
30
31
 
31
- // v4.x: createMMKV function exists
32
+ // v4.x: createMMKV function exists (uses `remove`)
32
33
  if ('createMMKV' in MMKVModule && typeof MMKVModule.createMMKV === 'function') {
33
34
  return MMKVModule.createMMKV(config);
34
35
  }
35
36
 
36
- // v3.x: MMKV is a constructor
37
+ // v3.x: MMKV is a constructor (uses `delete`, needs `remove` adapter)
37
38
  if ('MMKV' in MMKVModule && typeof MMKVModule.MMKV === 'function') {
38
- const MMKVClass = MMKVModule.MMKV;
39
- return new MMKVClass(config);
39
+ const instance = new MMKVModule.MMKV(config);
40
+ if (typeof instance.remove !== 'function' && typeof instance.delete === 'function') {
41
+ instance.remove = instance.delete.bind(instance);
42
+ }
43
+ return instance;
40
44
  }
41
45
  throw new Error('[rn-iconify] Could not initialize MMKV storage. ' + 'Please ensure react-native-mmkv (v3.x or v4.x) is properly installed.');
42
46
  }
@@ -142,8 +146,8 @@ class DiskCacheImpl {
142
146
  * Remove icon from disk cache
143
147
  */
144
148
  delete(iconName) {
145
- storage.delete(iconName);
146
- storage.delete(`${META_KEY_PREFIX}${iconName}`);
149
+ storage.remove(iconName);
150
+ storage.remove(`${META_KEY_PREFIX}${iconName}`);
147
151
  }
148
152
 
149
153
  /**
@@ -9,6 +9,7 @@ import * as MMKVModule from 'react-native-mmkv';
9
9
 
10
10
  /**
11
11
  * MMKV storage interface (compatible with both v3 and v4)
12
+ * v3.x uses `delete(key)`, v4.x uses `remove(key)`
12
13
  */
13
14
 
14
15
  /**
@@ -22,15 +23,18 @@ function createStorage(id) {
22
23
  id
23
24
  };
24
25
 
25
- // v4.x: createMMKV function exists
26
+ // v4.x: createMMKV function exists (uses `remove`)
26
27
  if ('createMMKV' in MMKVModule && typeof MMKVModule.createMMKV === 'function') {
27
28
  return MMKVModule.createMMKV(config);
28
29
  }
29
30
 
30
- // v3.x: MMKV is a constructor
31
+ // v3.x: MMKV is a constructor (uses `delete`, needs `remove` adapter)
31
32
  if ('MMKV' in MMKVModule && typeof MMKVModule.MMKV === 'function') {
32
- const MMKVClass = MMKVModule.MMKV;
33
- return new MMKVClass(config);
33
+ const instance = new MMKVModule.MMKV(config);
34
+ if (typeof instance.remove !== 'function' && typeof instance.delete === 'function') {
35
+ instance.remove = instance.delete.bind(instance);
36
+ }
37
+ return instance;
34
38
  }
35
39
  throw new Error('[rn-iconify] Could not initialize MMKV storage. ' + 'Please ensure react-native-mmkv (v3.x or v4.x) is properly installed.');
36
40
  }
@@ -136,8 +140,8 @@ class DiskCacheImpl {
136
140
  * Remove icon from disk cache
137
141
  */
138
142
  delete(iconName) {
139
- storage.delete(iconName);
140
- storage.delete(`${META_KEY_PREFIX}${iconName}`);
143
+ storage.remove(iconName);
144
+ storage.remove(`${META_KEY_PREFIX}${iconName}`);
141
145
  }
142
146
 
143
147
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-iconify",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "268,000+ Iconify icons for React Native with native MMKV caching and full TypeScript autocomplete",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -9,13 +9,14 @@ import * as MMKVModule from 'react-native-mmkv';
9
9
 
10
10
  /**
11
11
  * MMKV storage interface (compatible with both v3 and v4)
12
+ * v3.x uses `delete(key)`, v4.x uses `remove(key)`
12
13
  */
13
14
  interface MMKVStorage {
14
15
  getString(key: string): string | undefined;
15
16
  set(key: string, value: string | number | boolean): void;
16
17
  getNumber(key: string): number | undefined;
17
18
  contains(key: string): boolean;
18
- delete(key: string): void;
19
+ remove(key: string): boolean | void;
19
20
  clearAll(): void;
20
21
  getAllKeys(): string[];
21
22
  }
@@ -29,15 +30,18 @@ interface MMKVStorage {
29
30
  function createStorage(id: string): MMKVStorage {
30
31
  const config = { id };
31
32
 
32
- // v4.x: createMMKV function exists
33
+ // v4.x: createMMKV function exists (uses `remove`)
33
34
  if ('createMMKV' in MMKVModule && typeof MMKVModule.createMMKV === 'function') {
34
35
  return MMKVModule.createMMKV(config) as MMKVStorage;
35
36
  }
36
37
 
37
- // v3.x: MMKV is a constructor
38
+ // v3.x: MMKV is a constructor (uses `delete`, needs `remove` adapter)
38
39
  if ('MMKV' in MMKVModule && typeof MMKVModule.MMKV === 'function') {
39
- const MMKVClass = MMKVModule.MMKV as new (config: { id: string }) => MMKVStorage;
40
- return new MMKVClass(config);
40
+ const instance = new (MMKVModule.MMKV as any)(config);
41
+ if (typeof instance.remove !== 'function' && typeof instance.delete === 'function') {
42
+ instance.remove = instance.delete.bind(instance);
43
+ }
44
+ return instance as MMKVStorage;
41
45
  }
42
46
 
43
47
  throw new Error(
@@ -151,8 +155,8 @@ class DiskCacheImpl {
151
155
  * Remove icon from disk cache
152
156
  */
153
157
  delete(iconName: string): void {
154
- storage.delete(iconName);
155
- storage.delete(`${META_KEY_PREFIX}${iconName}`);
158
+ storage.remove(iconName);
159
+ storage.remove(`${META_KEY_PREFIX}${iconName}`);
156
160
  }
157
161
 
158
162
  /**