react-native-unistyles 3.2.5 → 3.4.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/core/UnistylesRegistry.cpp +135 -47
- package/cxx/core/UnistylesRegistry.h +23 -3
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +11 -9
- package/cxx/parser/Parser.cpp +47 -2
- package/cxx/shadowTree/NativeProps.h +44 -0
- package/cxx/shadowTree/ShadowLeafUpdate.h +8 -0
- package/cxx/shadowTree/ShadowTrafficController.h +16 -37
- package/cxx/shadowTree/ShadowTreeManager.cpp +8 -148
- package/cxx/shadowTree/ShadowTreeManager.h +1 -5
- package/lib/commonjs/components/native/Animated.js +2 -0
- package/lib/commonjs/components/native/Animated.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.js +2 -0
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +2 -0
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.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/web/convert/object/boxShadow.js +2 -2
- 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/components/native/Animated.js +3 -0
- package/lib/module/components/native/Animated.js.map +1 -1
- package/lib/module/components/native/Pressable.js +2 -0
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +2 -0
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.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/web/convert/object/boxShadow.js +2 -2
- 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 +16 -36
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.d.ts +4 -2
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts +5 -2
- package/lib/typescript/src/components/native/Pressable.native.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/server/resetServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +7 -2
- package/lib/typescript/src/types/core.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++/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/Func_void_UnistylesNativeMiniRuntime.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +2 -0
- package/package.json +28 -26
- package/src/components/native/Animated.tsx +18 -1
- package/src/components/native/Pressable.native.tsx +10 -2
- package/src/components/native/Pressable.tsx +7 -1
- package/src/index.ts +1 -1
- package/src/server/resetServerUnistyles.ts +2 -0
- package/src/specs/ShadowRegistry/index.ts +2 -1
- package/src/types/core.ts +7 -28
- package/src/web/convert/object/boxShadow.ts +2 -2
- package/src/web/index.ts +2 -3
- package/src/web/listener.ts +6 -0
- package/src/web/registry.ts +2 -0
- package/src/web/shadowRegistry.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../src/web/listener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,KAA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,KAAK,UAAU,EACpF,cAAc,KAAK,CAAC,kBAAkB,CAAC,UAmB1C;IAED,OAAO,GAAI,KAAK,WAAW,EAAE,MAAM,MAAM,UAKxC;IAED,MAAM,GAAI,KAAK,WAAW,EAAE,MAAM,MAAM,sBAqBvC;IAED,GAAG,GAAI,OAAO,eAAe,EAAE,WAAW,OAAO;;;MAYhD;IAED,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,eAAe,UAElD;IAED,KAAK,aAQJ;CACJ"}
|
|
@@ -19,6 +19,7 @@ export declare class UnistylesShadowRegistry {
|
|
|
19
19
|
setScopedTheme: (theme?: UnistylesTheme) => void;
|
|
20
20
|
getScopedTheme: () => undefined;
|
|
21
21
|
remove: (ref: any, hash?: string) => void;
|
|
22
|
+
reset: () => void;
|
|
22
23
|
flush: () => void;
|
|
23
24
|
}
|
|
24
25
|
//# sourceMappingURL=shadowRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOnE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAM7B;IAED,SAAS,GAAI,WAAW,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,OAAO;;;;MAsEjE;IAED,cAAc,GAAI,QAAQ,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAahC;IAED,KAAK,aAAW;CACnB"}
|
|
1
|
+
{"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOnE,qBAAa,uBAAuB;IAYpB,OAAO,CAAC,QAAQ;IAV5B,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,UAAU,CAAkC;gBAEhC,QAAQ,EAAE,iBAAiB;IAE/C,GAAG,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAM7B;IAED,SAAS,GAAI,WAAW,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,OAAO;;;;MAsEjE;IAED,cAAc,GAAI,QAAQ,cAAc,UAEvC;IAED,cAAc,kBAAyB;IAEvC,MAAM,GAAI,KAAK,GAAG,EAAE,OAAO,MAAM,UAahC;IAED,KAAK,aAGJ;IAED,KAAK,aAAW;CACnB"}
|
|
@@ -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 "ColorScheme" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "ColorScheme" and the Kotlin enum "ColorScheme".
|
|
19
19
|
*/
|
|
20
20
|
struct JColorScheme final: public jni::JavaClass<JColorScheme> {
|
|
21
21
|
public:
|
|
@@ -17,7 +17,7 @@ namespace margelo::nitro::unistyles {
|
|
|
17
17
|
using namespace facebook;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "Dimensions" and the
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "Dimensions" and the Kotlin data class "Dimensions".
|
|
21
21
|
*/
|
|
22
22
|
struct JDimensions final: public jni::JavaClass<JDimensions> {
|
|
23
23
|
public:
|
|
@@ -17,7 +17,7 @@ namespace margelo::nitro::unistyles {
|
|
|
17
17
|
using namespace facebook;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "Insets" and the
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "Insets" and the Kotlin data class "Insets".
|
|
21
21
|
*/
|
|
22
22
|
struct JInsets final: public jni::JavaClass<JInsets> {
|
|
23
23
|
public:
|
|
@@ -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 "Orientation" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "Orientation" and the Kotlin enum "Orientation".
|
|
19
19
|
*/
|
|
20
20
|
struct JOrientation final: public jni::JavaClass<JOrientation> {
|
|
21
21
|
public:
|
|
@@ -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:
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.unistyles
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_UnistylesNativeMiniRuntime_cxx: Func_void_UnistylesNativeMiniRun
|
|
|
59
58
|
override fun invoke(miniRuntime: UnistylesNativeMiniRuntime): Unit
|
|
60
59
|
= invoke_cxx(miniRuntime)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(miniRuntime: UnistylesNativeMiniRuntime): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.unistyles
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime_cxx:
|
|
|
59
58
|
override fun invoke(dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime): Unit
|
|
60
59
|
= invoke_cxx(dependencies,miniRuntime)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime): Unit
|
|
64
62
|
}
|
|
65
63
|
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt
CHANGED
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.unistyles
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
13
14
|
import com.margelo.nitro.core.HybridObject
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -120,6 +121,7 @@ abstract class HybridNativePlatformSpec: HybridObject() {
|
|
|
120
121
|
@Keep
|
|
121
122
|
protected open class CxxPart(javaPart: HybridNativePlatformSpec): HybridObject.CxxPart(javaPart) {
|
|
122
123
|
// C++ JHybridNativePlatformSpec::CxxPart::initHybrid(...)
|
|
124
|
+
@FastNative
|
|
123
125
|
external override fun initHybrid(): HybridData
|
|
124
126
|
}
|
|
125
127
|
override fun createCxxPart(): CxxPart {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.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",
|
|
@@ -127,39 +128,40 @@
|
|
|
127
128
|
"registry": "https://registry.npmjs.org/"
|
|
128
129
|
},
|
|
129
130
|
"dependencies": {
|
|
130
|
-
"@babel/types": "7.29.
|
|
131
|
+
"@babel/types": "7.29.8"
|
|
131
132
|
},
|
|
132
133
|
"devDependencies": {
|
|
133
|
-
"@callstack/repack": "5.
|
|
134
|
-
"@commitlint/config-conventional": "
|
|
135
|
-
"@react-native/normalize-colors": "0.
|
|
136
|
-
"@rspack/core": "
|
|
134
|
+
"@callstack/repack": "5.4.0",
|
|
135
|
+
"@commitlint/config-conventional": "21.2.3",
|
|
136
|
+
"@react-native/normalize-colors": "0.87.1",
|
|
137
|
+
"@rspack/core": "2.2.7",
|
|
137
138
|
"@types/jest": "30.0.0",
|
|
138
|
-
"@types/react": "19.2.
|
|
139
|
+
"@types/react": "19.2.18",
|
|
139
140
|
"babel-plugin-tester": "12.0.0",
|
|
140
|
-
"commitlint": "
|
|
141
|
-
"concurrently": "
|
|
142
|
-
"dpdm": "4.0
|
|
143
|
-
"esbuild": "0.
|
|
144
|
-
"jest": "30.2
|
|
145
|
-
"@babel/plugin-syntax-jsx": "7.
|
|
146
|
-
"@babel/runtime": "7.
|
|
147
|
-
"@react-native/babel-preset": "0.
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
141
|
+
"commitlint": "21.2.3",
|
|
142
|
+
"concurrently": "10.0.5",
|
|
143
|
+
"dpdm": "4.3.0",
|
|
144
|
+
"esbuild": "0.28.2",
|
|
145
|
+
"jest": "30.5.2",
|
|
146
|
+
"@babel/plugin-syntax-jsx": "7.29.7",
|
|
147
|
+
"@babel/runtime": "7.29.7",
|
|
148
|
+
"@react-native/babel-preset": "0.87.1",
|
|
149
|
+
"@react-native/jest-preset": "0.87.1",
|
|
150
|
+
"nitrogen": "0.37.1",
|
|
151
|
+
"oxfmt": "0.70.0",
|
|
152
|
+
"oxlint": "1.85.0",
|
|
151
153
|
"react": "19.2.3",
|
|
152
|
-
"react-native": "0.
|
|
153
|
-
"react-native-builder-bob": "0.
|
|
154
|
-
"react-native-nitro-modules": "0.
|
|
155
|
-
"react-native-reanimated": "4.
|
|
156
|
-
"react-native-web": "0.21.
|
|
157
|
-
"typescript": "
|
|
154
|
+
"react-native": "0.87.1",
|
|
155
|
+
"react-native-builder-bob": "0.43.1",
|
|
156
|
+
"react-native-nitro-modules": "0.37.1",
|
|
157
|
+
"react-native-reanimated": "4.7.0",
|
|
158
|
+
"react-native-web": "0.21.3",
|
|
159
|
+
"typescript": "6.0.3"
|
|
158
160
|
},
|
|
159
161
|
"peerDependencies": {
|
|
160
162
|
"@react-native/normalize-colors": "*",
|
|
161
163
|
"react": "*",
|
|
162
|
-
"react-native": ">=0.
|
|
164
|
+
"react-native": ">=0.81.0",
|
|
163
165
|
"react-native-edge-to-edge": "*",
|
|
164
166
|
"react-native-nitro-modules": "*",
|
|
165
167
|
"react-native-reanimated": "*"
|
|
@@ -176,7 +178,7 @@
|
|
|
176
178
|
"node": ">= 20.18.0"
|
|
177
179
|
},
|
|
178
180
|
"jest": {
|
|
179
|
-
"preset": "react-native",
|
|
181
|
+
"preset": "@react-native/jest-preset",
|
|
180
182
|
"modulePathIgnorePatterns": [
|
|
181
183
|
"<rootDir>/lib/",
|
|
182
184
|
"<rootDir>/cxx/tests"
|
|
@@ -7,7 +7,24 @@ import { SectionList } from './SectionList'
|
|
|
7
7
|
import { Text } from './Text'
|
|
8
8
|
import { View } from './View'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
type AnimatedComponent<T extends Parameters<typeof RNAnimated.createAnimatedComponent>[0]> = ReturnType<
|
|
11
|
+
typeof RNAnimated.createAnimatedComponent<T>
|
|
12
|
+
>
|
|
13
|
+
|
|
14
|
+
// explicit type keeps emitted declarations portable (RN 0.87+ Strict TypeScript API references private paths)
|
|
15
|
+
type UnistylesAnimated = Omit<
|
|
16
|
+
typeof RNAnimated,
|
|
17
|
+
'View' | 'Text' | 'FlatList' | 'Image' | 'ScrollView' | 'SectionList'
|
|
18
|
+
> & {
|
|
19
|
+
View: AnimatedComponent<typeof View>
|
|
20
|
+
Text: AnimatedComponent<typeof Text>
|
|
21
|
+
FlatList: AnimatedComponent<typeof FlatList>
|
|
22
|
+
Image: AnimatedComponent<typeof Image>
|
|
23
|
+
ScrollView: AnimatedComponent<typeof ScrollView>
|
|
24
|
+
SectionList: AnimatedComponent<typeof SectionList>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Animated: UnistylesAnimated = {
|
|
11
28
|
...RNAnimated,
|
|
12
29
|
View: RNAnimated.createAnimatedComponent(View),
|
|
13
30
|
Text: RNAnimated.createAnimatedComponent(Text),
|
|
@@ -3,9 +3,14 @@ import type { PressableProps as Props, View } from 'react-native'
|
|
|
3
3
|
import React, { forwardRef, useLayoutEffect, useRef } from 'react'
|
|
4
4
|
import { Pressable as NativePressableReactNative } from 'react-native'
|
|
5
5
|
|
|
6
|
+
import type { Nullable } from '../../types'
|
|
7
|
+
|
|
6
8
|
import { passForwardedRef } from '../../core'
|
|
7
9
|
import { UnistylesShadowRegistry } from '../../specs'
|
|
8
10
|
|
|
11
|
+
// instance type of View for both legacy and Strict TypeScript API (RN 0.87+)
|
|
12
|
+
type ViewRef = React.ComponentRef<typeof View>
|
|
13
|
+
|
|
9
14
|
type PressableProps = Props & {
|
|
10
15
|
variants?: Record<string, string | boolean>
|
|
11
16
|
}
|
|
@@ -24,8 +29,11 @@ const getStyles = (styleProps: Record<string, any> = {}) => {
|
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
export const Pressable
|
|
28
|
-
|
|
32
|
+
export const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<ViewRef>> = forwardRef<
|
|
33
|
+
ViewRef,
|
|
34
|
+
PressableProps
|
|
35
|
+
>(({ variants, style, ...props }, forwardedRef) => {
|
|
36
|
+
const storedRef = useRef<Nullable<ViewRef>>(null)
|
|
29
37
|
const scopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
|
30
38
|
|
|
31
39
|
useLayoutEffect(() => {
|
|
@@ -18,12 +18,18 @@ type WebPressableState = {
|
|
|
18
18
|
|
|
19
19
|
type WebPressableStyle = ((state: WebPressableState) => UnistylesValues) | UnistylesValues
|
|
20
20
|
|
|
21
|
+
// instance type of View for both legacy and Strict TypeScript API (RN 0.87+)
|
|
22
|
+
type ViewRef = React.ComponentRef<typeof View>
|
|
23
|
+
|
|
21
24
|
type PressableProps = Props & {
|
|
22
25
|
variants?: Variants
|
|
23
26
|
style?: WebPressableStyle
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
export const Pressable
|
|
29
|
+
export const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<ViewRef>> = forwardRef<
|
|
30
|
+
ViewRef,
|
|
31
|
+
PressableProps
|
|
32
|
+
>(({ style, ...props }, forwardedRef) => {
|
|
27
33
|
const scopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
|
28
34
|
let storedRef: HTMLElement | null = null
|
|
29
35
|
let classNames: ReturnType<typeof getClassName> | undefined = undefined
|
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'
|
|
@@ -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
|
|
package/src/types/core.ts
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
|
|
2
|
-
import type {
|
|
3
|
-
MatrixTransform,
|
|
4
|
-
PerspectiveTransform,
|
|
5
|
-
RotateTransform,
|
|
6
|
-
RotateXTransform,
|
|
7
|
-
RotateYTransform,
|
|
8
|
-
RotateZTransform,
|
|
9
|
-
ScaleTransform,
|
|
10
|
-
ScaleXTransform,
|
|
11
|
-
ScaleYTransform,
|
|
12
|
-
SkewXTransform,
|
|
13
|
-
SkewYTransform,
|
|
14
|
-
TranslateXTransform,
|
|
15
|
-
TranslateYTransform,
|
|
16
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
|
|
17
2
|
|
|
18
3
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
|
|
19
4
|
|
|
@@ -22,19 +7,13 @@ export type ShadowOffset = {
|
|
|
22
7
|
height: number
|
|
23
8
|
}
|
|
24
9
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ScaleYTransform &
|
|
33
|
-
TranslateXTransform &
|
|
34
|
-
TranslateYTransform &
|
|
35
|
-
SkewXTransform &
|
|
36
|
-
SkewYTransform &
|
|
37
|
-
MatrixTransform
|
|
10
|
+
type TransformEntry = Exclude<NonNullable<ViewStyle['transform']>, string>[number]
|
|
11
|
+
type TransformKeys<T> = T extends unknown ? keyof T : never
|
|
12
|
+
type TransformValue<T, K extends PropertyKey> = T extends unknown ? (K extends keyof T ? T[K] : never) : never
|
|
13
|
+
|
|
14
|
+
export type TransformStyles = {
|
|
15
|
+
[K in TransformKeys<TransformEntry>]: Exclude<TransformValue<TransformEntry, K>, void | undefined>
|
|
16
|
+
}
|
|
38
17
|
|
|
39
18
|
export type ScreenSize = {
|
|
40
19
|
width: number
|
|
@@ -17,7 +17,7 @@ export const getBoxShadow = (boxShadow: Array<BoxShadowValue>) => {
|
|
|
17
17
|
const value = shadow[key as keyof BoxShadowValue]
|
|
18
18
|
|
|
19
19
|
// Breakpoints
|
|
20
|
-
if (typeof value === 'object') {
|
|
20
|
+
if (value !== null && typeof value === 'object') {
|
|
21
21
|
Object.keys(value).forEach((breakpoint) => breakpoints.add(breakpoint))
|
|
22
22
|
}
|
|
23
23
|
})
|
|
@@ -41,7 +41,7 @@ export const getBoxShadow = (boxShadow: Array<BoxShadowValue>) => {
|
|
|
41
41
|
const [key] = Object.keys(shadow)
|
|
42
42
|
const value = shadow[key as keyof BoxShadowValue]
|
|
43
43
|
|
|
44
|
-
if (typeof value === 'object' && keyInObject(value, breakpoint)) {
|
|
44
|
+
if (value !== null && typeof value === 'object' && keyInObject(value, breakpoint)) {
|
|
45
45
|
return [key, value[breakpoint]]
|
|
46
46
|
}
|
|
47
47
|
|
package/src/web/index.ts
CHANGED
|
@@ -26,12 +26,11 @@ export const StyleSheet = {
|
|
|
26
26
|
bottom: 0,
|
|
27
27
|
},
|
|
28
28
|
compose: (a: object, b: object) => RNStyleSheet.compose(a, b),
|
|
29
|
-
flatten: (...styles: Array<object>) =>
|
|
29
|
+
flatten: (...styles: Array<object>) =>
|
|
30
|
+
(RNStyleSheet.flatten as unknown as (...styles: Array<object>) => object)(...styles),
|
|
30
31
|
hairlineWidth: 1,
|
|
31
32
|
} as unknown as typeof NativeStyleSheet
|
|
32
33
|
|
|
33
34
|
export const UnistylesRuntime = unistyles.services.runtime as unknown as typeof NativeUnistylesRuntime
|
|
34
35
|
export const UnistylesShadowRegistry = unistyles.services
|
|
35
36
|
.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()
|