react-native-unistyles 3.2.4 → 3.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.
Files changed (91) hide show
  1. package/README.md +3 -3
  2. package/android/CMakeLists.txt +2 -1
  3. package/cxx/converters/BackgroundImageConverter.cpp +55 -0
  4. package/cxx/converters/BackgroundImageConverter.h +14 -0
  5. package/cxx/converters/TransformOriginConverter.cpp +33 -0
  6. package/cxx/converters/TransformOriginConverter.h +13 -0
  7. package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -2
  8. package/cxx/parser/Parser.cpp +46 -0
  9. package/lib/commonjs/index.js +0 -12
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/reanimated/useAnimatedTheme.js +14 -3
  12. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
  13. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +14 -4
  14. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
  15. package/lib/commonjs/server/resetServerUnistyles.js +2 -0
  16. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  17. package/lib/commonjs/specs/ShadowRegistry/index.js +2 -1
  18. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  19. package/lib/commonjs/specs/StyleSheet/index.js +1 -1
  20. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  21. package/lib/commonjs/web/convert/object/boxShadow.js +1 -1
  22. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  23. package/lib/commonjs/web/index.js +0 -17
  24. package/lib/commonjs/web/index.js.map +1 -1
  25. package/lib/commonjs/web/listener.js +5 -0
  26. package/lib/commonjs/web/listener.js.map +1 -1
  27. package/lib/commonjs/web/registry.js +2 -0
  28. package/lib/commonjs/web/registry.js.map +1 -1
  29. package/lib/commonjs/web/shadowRegistry.js +4 -0
  30. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  31. package/lib/module/index.js +1 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/reanimated/useAnimatedTheme.js +16 -5
  34. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
  35. package/lib/module/reanimated/useAnimatedTheme.native.js +16 -6
  36. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
  37. package/lib/module/server/resetServerUnistyles.js +2 -0
  38. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  39. package/lib/module/specs/ShadowRegistry/index.js +2 -1
  40. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  41. package/lib/module/specs/StyleSheet/index.js +1 -1
  42. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  43. package/lib/module/web/convert/object/boxShadow.js +1 -1
  44. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  45. package/lib/module/web/index.js +0 -1
  46. package/lib/module/web/index.js.map +1 -1
  47. package/lib/module/web/listener.js +5 -0
  48. package/lib/module/web/listener.js.map +1 -1
  49. package/lib/module/web/registry.js +2 -0
  50. package/lib/module/web/registry.js.map +1 -1
  51. package/lib/module/web/shadowRegistry.js +4 -0
  52. package/lib/module/web/shadowRegistry.js.map +1 -1
  53. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  54. package/lib/typescript/src/index.d.ts +1 -1
  55. package/lib/typescript/src/index.d.ts.map +1 -1
  56. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
  57. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
  58. package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -1
  59. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  60. package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
  61. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  62. package/lib/typescript/src/web/index.d.ts +0 -1
  63. package/lib/typescript/src/web/index.d.ts.map +1 -1
  64. package/lib/typescript/src/web/listener.d.ts +1 -0
  65. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  66. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  67. package/lib/typescript/src/web/shadowRegistry.d.ts +1 -0
  68. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  69. package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
  70. package/nitrogen/generated/android/c++/JDimensions.hpp +1 -1
  71. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +14 -14
  72. package/nitrogen/generated/android/c++/JInsets.hpp +1 -1
  73. package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
  74. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
  75. package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +1 -1
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -1
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -1
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -1
  79. package/package.json +9 -8
  80. package/plugin/index.js +42 -30
  81. package/src/index.ts +1 -1
  82. package/src/reanimated/useAnimatedTheme.native.ts +21 -6
  83. package/src/reanimated/useAnimatedTheme.ts +20 -7
  84. package/src/server/resetServerUnistyles.ts +2 -0
  85. package/src/specs/ShadowRegistry/index.ts +2 -1
  86. package/src/specs/StyleSheet/index.ts +2 -2
  87. package/src/web/convert/object/boxShadow.ts +1 -1
  88. package/src/web/index.ts +0 -2
  89. package/src/web/listener.ts +6 -0
  90. package/src/web/registry.ts +2 -0
  91. package/src/web/shadowRegistry.ts +5 -0
@@ -15,7 +15,7 @@ namespace margelo::nitro::unistyles {
15
15
  using namespace facebook;
16
16
 
17
17
  /**
18
- * The C++ JNI bridge between the C++ enum "UnistyleDependency" and the the Kotlin enum "UnistyleDependency".
18
+ * The C++ JNI bridge between the C++ enum "UnistyleDependency" and the Kotlin enum "UnistyleDependency".
19
19
  */
20
20
  struct JUnistyleDependency final: public jni::JavaClass<JUnistyleDependency> {
21
21
  public:
@@ -23,7 +23,7 @@ namespace margelo::nitro::unistyles {
23
23
  using namespace facebook;
24
24
 
25
25
  /**
26
- * The C++ JNI bridge between the C++ struct "UnistylesNativeMiniRuntime" and the the Kotlin data class "UnistylesNativeMiniRuntime".
26
+ * The C++ JNI bridge between the C++ struct "UnistylesNativeMiniRuntime" and the Kotlin data class "UnistylesNativeMiniRuntime".
27
27
  */
28
28
  struct JUnistylesNativeMiniRuntime final: public jni::JavaClass<JUnistylesNativeMiniRuntime> {
29
29
  public:
@@ -35,7 +35,7 @@ data class Dimensions(
35
35
  }
36
36
 
37
37
  override fun hashCode(): Int {
38
- return arrayOf(
38
+ return arrayOf<Any?>(
39
39
  width,
40
40
  height
41
41
  ).contentDeepHashCode()
@@ -47,7 +47,7 @@ data class Insets(
47
47
  }
48
48
 
49
49
  override fun hashCode(): Int {
50
- return arrayOf(
50
+ return arrayOf<Any?>(
51
51
  top,
52
52
  bottom,
53
53
  left,
@@ -71,7 +71,7 @@ data class UnistylesNativeMiniRuntime(
71
71
  }
72
72
 
73
73
  override fun hashCode(): Int {
74
- return arrayOf(
74
+ return arrayOf<Any?>(
75
75
  colorScheme,
76
76
  screen,
77
77
  contentSizeCategory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.2.4",
3
+ "version": "3.3.0",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "NODE_ENV=babel-test jest ./plugin ./src/__tests__",
@@ -31,6 +31,7 @@
31
31
  "default": "./lib/commonjs/index.js"
32
32
  },
33
33
  "./mocks": {
34
+ "types": "./lib/typescript/src/mocks.d.ts",
34
35
  "import": "./lib/module/mocks.js",
35
36
  "browser": "./lib/module/mocks.js",
36
37
  "react-native": "./src/mocks.ts",
@@ -132,7 +133,7 @@
132
133
  "devDependencies": {
133
134
  "@callstack/repack": "5.2.4",
134
135
  "@commitlint/config-conventional": "20.4.2",
135
- "@react-native/normalize-colors": "0.83.2",
136
+ "@react-native/normalize-colors": "0.85.3",
136
137
  "@rspack/core": "1.7.6",
137
138
  "@types/jest": "30.0.0",
138
139
  "@types/react": "19.2.14",
@@ -144,15 +145,15 @@
144
145
  "jest": "30.2.0",
145
146
  "@babel/plugin-syntax-jsx": "7.28.6",
146
147
  "@babel/runtime": "7.28.6",
147
- "@react-native/babel-preset": "0.83.2",
148
- "nitrogen": "0.35.5",
148
+ "@react-native/babel-preset": "0.85.3",
149
+ "nitrogen": "0.36.1",
149
150
  "oxfmt": "0.35.0",
150
151
  "oxlint": "1.50.0",
151
- "react": "19.2.0",
152
- "react-native": "0.83.2",
152
+ "react": "19.2.3",
153
+ "react-native": "0.85.3",
153
154
  "react-native-builder-bob": "0.40.18",
154
- "react-native-nitro-modules": "0.35.5",
155
- "react-native-reanimated": "4.2.2",
155
+ "react-native-nitro-modules": "0.36.1",
156
+ "react-native-reanimated": "4.3.1",
156
157
  "react-native-web": "0.21.2",
157
158
  "typescript": "5.9.3"
158
159
  },
package/plugin/index.js CHANGED
@@ -219,6 +219,18 @@ var UnistyleDependency = {
219
219
  Ime: 14,
220
220
  Rtl: 15
221
221
  };
222
+ function getStyleKeyName(key) {
223
+ if (!key) {
224
+ return null;
225
+ }
226
+ if (t4.isIdentifier(key)) {
227
+ return key.name;
228
+ }
229
+ if (t4.isStringLiteral(key) || t4.isNumericLiteral(key) || t4.isBooleanLiteral(key)) {
230
+ return String(key.value);
231
+ }
232
+ return null;
233
+ }
222
234
  function getProperty(property) {
223
235
  if (!property) {
224
236
  return void 0;
@@ -389,28 +401,30 @@ function getStylesDependenciesFromObject(path2) {
389
401
  const stylesheet = path2.node.arguments[0];
390
402
  if (t4.isObjectExpression(stylesheet)) {
391
403
  stylesheet?.properties.forEach((property) => {
392
- if (!t4.isObjectProperty(property) || !t4.isIdentifier(property.key)) {
404
+ if (!t4.isObjectProperty(property)) {
393
405
  return;
394
406
  }
395
- if (t4.isObjectProperty(property)) {
396
- if (t4.isObjectExpression(property.value)) {
397
- property.value.properties.forEach((innerProp) => {
398
- if (t4.isObjectProperty(innerProp) && t4.isIdentifier(innerProp.key) && t4.isIdentifier(property.key) && innerProp.key.name === "variants") {
399
- detectedStylesWithVariants.add({
400
- label: "variants",
401
- key: property.key.name
402
- });
403
- }
404
- });
405
- }
407
+ const styleKey = getStyleKeyName(property.key);
408
+ if (!styleKey) {
409
+ return;
410
+ }
411
+ if (t4.isObjectExpression(property.value)) {
412
+ property.value.properties.forEach((innerProp) => {
413
+ if (t4.isObjectProperty(innerProp) && t4.isIdentifier(innerProp.key) && innerProp.key.name === "variants") {
414
+ detectedStylesWithVariants.add({
415
+ label: "variants",
416
+ key: styleKey
417
+ });
418
+ }
419
+ });
406
420
  }
407
421
  if (t4.isArrowFunctionExpression(property.value)) {
408
422
  if (t4.isObjectExpression(property.value.body)) {
409
423
  property.value.body.properties.forEach((innerProp) => {
410
- if (t4.isObjectProperty(innerProp) && t4.isIdentifier(innerProp.key) && t4.isIdentifier(property.key) && innerProp.key.name === "variants") {
424
+ if (t4.isObjectProperty(innerProp) && t4.isIdentifier(innerProp.key) && innerProp.key.name === "variants") {
411
425
  detectedStylesWithVariants.add({
412
426
  label: "variants",
413
- key: property.key.name
427
+ key: styleKey
414
428
  });
415
429
  }
416
430
  });
@@ -493,10 +507,10 @@ function getStylesDependenciesFromFunction(funcPath) {
493
507
  if (Array.isArray(stylePath)) {
494
508
  return;
495
509
  }
496
- if (!stylePath.isIdentifier()) {
510
+ const styleKey = getStyleKeyName(stylePath.node);
511
+ if (!styleKey) {
497
512
  return;
498
513
  }
499
- const styleKey = stylePath.node.name;
500
514
  const valuePath = propPath.get("value");
501
515
  if (Array.isArray(valuePath)) {
502
516
  return;
@@ -901,13 +915,12 @@ function index_default() {
901
915
  if (detectedDependencies) {
902
916
  if (t6.isObjectExpression(arg)) {
903
917
  arg.properties.forEach((property) => {
904
- if (t6.isObjectProperty(property) && t6.isIdentifier(property.key) && Object.prototype.hasOwnProperty.call(detectedDependencies, property.key.name)) {
905
- addDependencies(
906
- state,
907
- property.key.name,
908
- property,
909
- detectedDependencies[property.key.name] ?? []
910
- );
918
+ if (!t6.isObjectProperty(property)) {
919
+ return;
920
+ }
921
+ const styleKey = getStyleKeyName(property.key);
922
+ if (styleKey && Object.prototype.hasOwnProperty.call(detectedDependencies, styleKey)) {
923
+ addDependencies(state, styleKey, property, detectedDependencies[styleKey] ?? []);
911
924
  }
912
925
  });
913
926
  }
@@ -920,13 +933,12 @@ function index_default() {
920
933
  const body = t6.isBlockStatement(arg.body) ? arg.body.body.find((statement) => t6.isReturnStatement(statement))?.argument : arg.body;
921
934
  if (t6.isObjectExpression(body)) {
922
935
  body.properties.forEach((property) => {
923
- if (t6.isObjectProperty(property) && t6.isIdentifier(property.key) && Object.prototype.hasOwnProperty.call(detectedDependencies, property.key.name)) {
924
- addDependencies(
925
- state,
926
- property.key.name,
927
- property,
928
- detectedDependencies[property.key.name] ?? []
929
- );
936
+ if (!t6.isObjectProperty(property)) {
937
+ return;
938
+ }
939
+ const styleKey = getStyleKeyName(property.key);
940
+ if (styleKey && Object.prototype.hasOwnProperty.call(detectedDependencies, styleKey)) {
941
+ addDependencies(state, styleKey, property, detectedDependencies[styleKey] ?? []);
930
942
  }
931
943
  });
932
944
  }
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ if (majorReactVersions === undefined || majorReactVersions < 19) {
6
6
  throw new Error('Unistyles 🦄: To enable full Fabric power you need to use React 19.0.0 or higher')
7
7
  }
8
8
 
9
- export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
9
+ export { StyleSheet, UnistylesRuntime } from './specs'
10
10
  export { UnistyleDependency } from './specs'
11
11
  export { mq } from './mq'
12
12
  export type { UnistylesThemes, UnistylesBreakpoints } from './global'
@@ -1,22 +1,37 @@
1
- import { useEffect } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { type SharedValue, useSharedValue } from 'react-native-reanimated'
3
3
 
4
4
  import type { UnistylesTheme } from '../types'
5
5
 
6
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
6
+ import { StyleSheet, UnistyleDependency, UnistylesRuntime, UnistylesShadowRegistry } from '../specs'
7
7
 
8
8
  export const useAnimatedTheme = () => {
9
- const theme = useSharedValue(UnistylesRuntime.getTheme())
9
+ const [scopedTheme, setScopedTheme] = useState(
10
+ () => UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme | undefined,
11
+ )
12
+ const theme = useSharedValue(UnistylesRuntime.getTheme(scopedTheme))
13
+ const maybeNewScopedTheme = UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme | undefined
14
+
15
+ if (scopedTheme !== maybeNewScopedTheme) {
16
+ setScopedTheme(maybeNewScopedTheme)
17
+ theme.set(UnistylesRuntime.getTheme(maybeNewScopedTheme))
18
+ }
10
19
 
11
20
  useEffect(() => {
12
21
  const dispose = StyleSheet.addChangeListener((changedDependencies) => {
13
- if (changedDependencies.includes(UnistyleDependency.Theme)) {
14
- theme.set(UnistylesRuntime.getTheme())
22
+ if (!changedDependencies.includes(UnistyleDependency.Theme)) {
23
+ return
24
+ }
25
+
26
+ if (scopedTheme) {
27
+ return
15
28
  }
29
+
30
+ theme.set(UnistylesRuntime.getTheme())
16
31
  })
17
32
 
18
33
  return () => dispose()
19
- }, [])
34
+ }, [scopedTheme])
20
35
 
21
36
  return theme as SharedValue<UnistylesTheme>
22
37
  }
@@ -1,23 +1,36 @@
1
- import { useEffect } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { type SharedValue, useSharedValue } from 'react-native-reanimated'
3
3
 
4
4
  import type { UnistylesTheme } from '../types'
5
5
 
6
- import { UnistyleDependency, UnistylesRuntime } from '../specs'
6
+ import { UnistyleDependency, UnistylesRuntime, UnistylesShadowRegistry } from '../specs'
7
7
  import { services } from '../web/services'
8
8
 
9
9
  export const useAnimatedTheme = () => {
10
- const theme = useSharedValue(UnistylesRuntime.getTheme())
10
+ const [scopedTheme, setScopedTheme] = useState(
11
+ () => UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme | undefined,
12
+ )
13
+ const theme = useSharedValue(UnistylesRuntime.getTheme(scopedTheme))
14
+ const maybeNewScopedTheme = UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme | undefined
15
+
16
+ if (scopedTheme !== maybeNewScopedTheme) {
17
+ setScopedTheme(maybeNewScopedTheme)
18
+ theme.set(UnistylesRuntime.getTheme(maybeNewScopedTheme))
19
+ }
11
20
 
12
21
  useEffect(() => {
13
- const dispose = services.listener.addListeners([UnistyleDependency.Theme], () =>
14
- theme.set(UnistylesRuntime.getTheme()),
15
- )
22
+ const dispose = services.listener.addListeners([UnistyleDependency.Theme], () => {
23
+ if (scopedTheme) {
24
+ return
25
+ }
26
+
27
+ theme.set(UnistylesRuntime.getTheme())
28
+ })
16
29
 
17
30
  return () => {
18
31
  dispose()
19
32
  }
20
- }, [])
33
+ }, [scopedTheme])
21
34
 
22
35
  return theme as SharedValue<UnistylesTheme>
23
36
  }
@@ -7,4 +7,6 @@ export const resetServerUnistyles = () => {
7
7
  }
8
8
 
9
9
  unistyles.services.registry.reset()
10
+ unistyles.services.shadowRegistry.reset()
11
+ unistyles.services.listener.reset()
10
12
  }
@@ -19,12 +19,13 @@ interface ShadowRegistry extends UnistylesShadowRegistrySpec {
19
19
  const HybridShadowRegistry = NitroModules.createHybridObject<ShadowRegistry>('UnistylesShadowRegistry')
20
20
 
21
21
  const SUSPENSE_TAG = 13
22
+ const OFFSCREEN_TAG = 22
22
23
 
23
24
  const isInsideSuspendedBoundary = (fiber: any): boolean => {
24
25
  let current = fiber?.return
25
26
 
26
27
  while (current) {
27
- if (current.tag === SUSPENSE_TAG && current.memoizedState !== null) {
28
+ if ((current.tag === SUSPENSE_TAG || current.tag === OFFSCREEN_TAG) && current.memoizedState !== null) {
28
29
  return true
29
30
  }
30
31
 
@@ -35,7 +35,7 @@ export type UnistylesConfig = {
35
35
  }
36
36
 
37
37
  export interface UnistylesStyleSheet extends UnistylesStyleSheetSpec {
38
- absoluteFillObject: typeof NativeStyleSheetType.absoluteFillObject
38
+ absoluteFillObject: typeof NativeStyleSheetType.absoluteFill
39
39
  absoluteFill: typeof NativeStyleSheetType.absoluteFill
40
40
  compose: typeof NativeStyleSheetType.compose
41
41
  flatten: typeof NativeStyleSheetType.flatten
@@ -52,7 +52,7 @@ export interface UnistylesStyleSheet extends UnistylesStyleSheetSpec {
52
52
 
53
53
  const HybridUnistylesStyleSheet = NitroModules.createHybridObject<UnistylesStyleSheet>('UnistylesStyleSheet')
54
54
 
55
- HybridUnistylesStyleSheet.absoluteFillObject = NativeStyleSheet.absoluteFillObject
55
+ HybridUnistylesStyleSheet.absoluteFillObject = NativeStyleSheet.absoluteFill
56
56
  HybridUnistylesStyleSheet.absoluteFill = NativeStyleSheet.absoluteFill
57
57
  HybridUnistylesStyleSheet.flatten = NativeStyleSheet.flatten
58
58
  HybridUnistylesStyleSheet.compose = NativeStyleSheet.compose
@@ -7,7 +7,7 @@ import { normalizeNumericValue } from '../utils'
7
7
  const createBoxShadowValue = (style: BoxShadowValue) => {
8
8
  const { offsetX, offsetY, blurRadius = 0, spreadDistance = 0, color = '#000', inset } = style
9
9
 
10
- return `${inset ? 'inset ' : ''}${normalizeNumericValue(offsetX)} ${normalizeNumericValue(offsetY)} ${normalizeNumericValue(blurRadius as number)} ${normalizeNumericValue(spreadDistance as number)} ${color}`
10
+ return `${inset ? 'inset ' : ''}${normalizeNumericValue(offsetX)} ${normalizeNumericValue(offsetY)} ${normalizeNumericValue(blurRadius as number)} ${normalizeNumericValue(spreadDistance as number)} ${String(color)}`
11
11
  }
12
12
 
13
13
  export const getBoxShadow = (boxShadow: Array<BoxShadowValue>) => {
package/src/web/index.ts CHANGED
@@ -33,5 +33,3 @@ export const StyleSheet = {
33
33
  export const UnistylesRuntime = unistyles.services.runtime as unknown as typeof NativeUnistylesRuntime
34
34
  export const UnistylesShadowRegistry = unistyles.services
35
35
  .shadowRegistry as unknown as typeof NativeUnistylesShadowRegistry
36
-
37
- export * from './mock'
@@ -48,6 +48,12 @@ export class UnistylesListener {
48
48
  }
49
49
  }
50
50
 
51
+ reset = () => {
52
+ this.listeners.forEach((listeners) => listeners.clear())
53
+ this.stylesheetListeners.forEach((listeners) => listeners.clear())
54
+ this.changeListeners.clear()
55
+ }
56
+
51
57
  initListeners = () => {
52
58
  if (this.isInitialized) {
53
59
  return
@@ -126,7 +126,9 @@ export class UnistylesRegistry {
126
126
  }
127
127
 
128
128
  reset = () => {
129
+ this.disposeListenersMap.forEach((dispose) => dispose())
129
130
  this.css.reset()
131
+ this.stylesheets.clear()
130
132
  this.stylesCache.clear()
131
133
  this.dependenciesMap.clear()
132
134
  this.disposeListenersMap.clear()
@@ -121,5 +121,10 @@ export class UnistylesShadowRegistry {
121
121
  })
122
122
  }
123
123
 
124
+ reset = () => {
125
+ this.disposeMap.forEach((dispose) => dispose())
126
+ this.disposeMap.clear()
127
+ }
128
+
124
129
  flush = () => {}
125
130
  }