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.
- package/README.md +3 -3
- package/android/CMakeLists.txt +2 -1
- package/cxx/converters/BackgroundImageConverter.cpp +55 -0
- package/cxx/converters/BackgroundImageConverter.h +14 -0
- package/cxx/converters/TransformOriginConverter.cpp +33 -0
- package/cxx/converters/TransformOriginConverter.h +13 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -2
- package/cxx/parser/Parser.cpp +46 -0
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.js +14 -3
- package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js +14 -4
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +2 -0
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/index.js +0 -17
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js +5 -0
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js +2 -0
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +4 -0
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.js +16 -5
- package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.native.js +16 -6
- package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/module/server/resetServerUnistyles.js +2 -0
- package/lib/module/server/resetServerUnistyles.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +2 -1
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +1 -1
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/index.js +0 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js +5 -0
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js +2 -0
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +4 -0
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
- package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +0 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts +1 -0
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JDimensions.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +14 -14
- package/nitrogen/generated/android/c++/JInsets.hpp +1 -1
- package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -1
- package/package.json +9 -8
- package/plugin/index.js +42 -30
- package/src/index.ts +1 -1
- package/src/reanimated/useAnimatedTheme.native.ts +21 -6
- package/src/reanimated/useAnimatedTheme.ts +20 -7
- package/src/server/resetServerUnistyles.ts +2 -0
- package/src/specs/ShadowRegistry/index.ts +2 -1
- package/src/specs/StyleSheet/index.ts +2 -2
- package/src/web/convert/object/boxShadow.ts +1 -1
- package/src/web/index.ts +0 -2
- package/src/web/listener.ts +6 -0
- package/src/web/registry.ts +2 -0
- 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
|
|
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
|
|
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:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.
|
|
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.
|
|
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.
|
|
148
|
-
"nitrogen": "0.
|
|
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.
|
|
152
|
-
"react-native": "0.
|
|
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.
|
|
155
|
-
"react-native-reanimated": "4.
|
|
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)
|
|
404
|
+
if (!t4.isObjectProperty(property)) {
|
|
393
405
|
return;
|
|
394
406
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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) &&
|
|
424
|
+
if (t4.isObjectProperty(innerProp) && t4.isIdentifier(innerProp.key) && innerProp.key.name === "variants") {
|
|
411
425
|
detectedStylesWithVariants.add({
|
|
412
426
|
label: "variants",
|
|
413
|
-
key:
|
|
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
|
-
|
|
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)
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
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)
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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.
|
|
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.
|
|
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'
|
package/src/web/listener.ts
CHANGED
|
@@ -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
|
package/src/web/registry.ts
CHANGED
|
@@ -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()
|