react-native-unistyles 3.0.0-nightly-20250215 → 3.0.0-nightly-20250219
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/android/src/main/java/com/unistyles/NativePlatform+insets.kt +9 -1
- package/cxx/common/Helpers.h +85 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +1 -1
- package/cxx/parser/Parser.cpp +44 -2
- package/lib/commonjs/components/native/Pressable.native.js +4 -0
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +4 -0
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +1 -1
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/native/Pressable.native.tsx +7 -0
- package/src/specs/ShadowRegistry/index.ts +1 -0
@@ -24,6 +24,7 @@ class NativePlatformInsets(
|
|
24
24
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
25
25
|
private val diffMiniRuntime: () -> Array<UnistyleDependency>
|
26
26
|
) {
|
27
|
+
private var _shouldListenToImeEvents = false
|
27
28
|
private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
|
28
29
|
private var _insets: Insets = Insets(0.0, 0.0, 0.0, 0.0, 0.0)
|
29
30
|
|
@@ -113,6 +114,8 @@ class NativePlatformInsets(
|
|
113
114
|
}
|
114
115
|
|
115
116
|
fun startInsetsListener() {
|
117
|
+
_shouldListenToImeEvents = true
|
118
|
+
|
116
119
|
reactContext.currentActivity?.let { activity ->
|
117
120
|
activity.findViewById<View>(android.R.id.content)?.let { mainView ->
|
118
121
|
ViewCompat.setOnApplyWindowInsetsListener(mainView) { _, insets ->
|
@@ -130,6 +133,10 @@ class NativePlatformInsets(
|
|
130
133
|
insets: WindowInsetsCompat,
|
131
134
|
runningAnimations: List<WindowInsetsAnimationCompat>
|
132
135
|
): WindowInsetsCompat {
|
136
|
+
if (!_shouldListenToImeEvents) {
|
137
|
+
return insets
|
138
|
+
}
|
139
|
+
|
133
140
|
runningAnimations.firstOrNull()?.let {
|
134
141
|
val bottomInset = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom.toDouble() - this@NativePlatformInsets._insets.bottom
|
135
142
|
val nextBottomInset = if (bottomInset < 0) {
|
@@ -160,9 +167,10 @@ class NativePlatformInsets(
|
|
160
167
|
reactContext.currentActivity?.let { activity ->
|
161
168
|
activity.window?.decorView?.let { view ->
|
162
169
|
ViewCompat.setOnApplyWindowInsetsListener(view, null)
|
163
|
-
ViewCompat.setWindowInsetsAnimationCallback(view, null)
|
164
170
|
}
|
165
171
|
}
|
172
|
+
|
173
|
+
_shouldListenToImeEvents = false
|
166
174
|
}
|
167
175
|
|
168
176
|
fun addImeListener(listener: CxxImeListener) {
|
package/cxx/common/Helpers.h
CHANGED
@@ -225,4 +225,89 @@ inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vec
|
|
225
225
|
return result;
|
226
226
|
}
|
227
227
|
|
228
|
+
inline void debugPrintJSIObject(jsi::Runtime& rt, std::string& name, jsi::Object& obj) {
|
229
|
+
auto console = rt.global().getPropertyAsObject(rt, "console");
|
230
|
+
auto log = console.getPropertyAsFunction(rt, "log");
|
231
|
+
auto parser = [&](const std::string& key, jsi::Value& value){
|
232
|
+
if (value.isBool()) {
|
233
|
+
std::string output = key + ": " + (value.getBool() ? "true" : "false");
|
234
|
+
log.call(rt, output);
|
235
|
+
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
|
239
|
+
if (value.isNumber()) {
|
240
|
+
std::string output = key + ": " + std::to_string(value.getNumber());
|
241
|
+
log.call(rt, output);
|
242
|
+
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
|
246
|
+
if (value.isString()) {
|
247
|
+
std::string output = key + ": " + value.getString(rt).utf8(rt);
|
248
|
+
log.call(rt, output);
|
249
|
+
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
|
253
|
+
if (value.isUndefined()) {
|
254
|
+
std::string output = key + ": undefined";
|
255
|
+
log.call(rt, output);
|
256
|
+
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
260
|
+
if (value.isNull()) {
|
261
|
+
std::string output = key + ": null";
|
262
|
+
log.call(rt, output);
|
263
|
+
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
};
|
267
|
+
|
268
|
+
log.call(rt, "===" + name + "===");
|
269
|
+
|
270
|
+
enumerateJSIObject(rt, obj, [&](const std::string& key, jsi::Value& value){
|
271
|
+
if (value.isObject()) {
|
272
|
+
if (value.asObject(rt).isArray(rt)) {
|
273
|
+
iterateJSIArray(rt, value.asObject(rt).asArray(rt), [&](size_t i, jsi::Value& nestedValue){
|
274
|
+
std::string printableKey = key + ": Array[" + std::to_string(i) + "]";
|
275
|
+
|
276
|
+
log.call(rt, printableKey);
|
277
|
+
|
278
|
+
if (nestedValue.isObject()) {
|
279
|
+
enumerateJSIObject(rt, nestedValue.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
280
|
+
parser(nestedKey, nestedValue);
|
281
|
+
});
|
282
|
+
} else {
|
283
|
+
parser(printableKey, nestedValue);
|
284
|
+
}
|
285
|
+
|
286
|
+
std::string endKey = key + ": Array[end]";
|
287
|
+
|
288
|
+
log.call(rt, endKey);
|
289
|
+
});
|
290
|
+
}
|
291
|
+
|
292
|
+
if (value.asObject(rt).isFunction(rt)) {
|
293
|
+
std::string output = key + ": [Function]";
|
294
|
+
|
295
|
+
log.call(rt, output);
|
296
|
+
|
297
|
+
return;
|
298
|
+
}
|
299
|
+
|
300
|
+
enumerateJSIObject(rt, value.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
301
|
+
parser(nestedKey, nestedValue);
|
302
|
+
});
|
303
|
+
|
304
|
+
return;
|
305
|
+
}
|
306
|
+
|
307
|
+
parser(key, value);
|
308
|
+
});
|
309
|
+
|
310
|
+
log.call(rt, "===/" + name + "===");
|
311
|
+
}
|
312
|
+
|
228
313
|
}
|
@@ -76,7 +76,7 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
76
76
|
);
|
77
77
|
|
78
78
|
// before linking we need to check if given unistyle is affected by scoped theme
|
79
|
-
if (scopedTheme.has_value()) {
|
79
|
+
if (scopedTheme.has_value() && unistyle->styleKey != helpers::EXOTIC_STYLE_KEY) {
|
80
80
|
auto parsedStyleSheet = parser.getParsedStyleSheetForScopedTheme(rt, unistyle, scopedTheme.value());
|
81
81
|
|
82
82
|
// if so we need to force update
|
package/cxx/parser/Parser.cpp
CHANGED
@@ -908,7 +908,7 @@ folly::dynamic parser::Parser::parseStylesToShadowTreeStyles(jsi::Runtime& rt, c
|
|
908
908
|
for (const auto& unistyleData : unistyles) {
|
909
909
|
// this can happen for exotic stylesheets
|
910
910
|
if (!unistyleData->parsedStyle.has_value()) {
|
911
|
-
|
911
|
+
continue;
|
912
912
|
}
|
913
913
|
|
914
914
|
helpers::enumerateJSIObject(rt, unistyleData->parsedStyle.value(), [&](const std::string& propertyName, jsi::Value& propertyValue){
|
@@ -916,7 +916,49 @@ folly::dynamic parser::Parser::parseStylesToShadowTreeStyles(jsi::Runtime& rt, c
|
|
916
916
|
return convertedStyles.setProperty(rt, propertyName.c_str(), jsi::Value(state.parseColor(propertyValue)));
|
917
917
|
}
|
918
918
|
|
919
|
-
|
919
|
+
if (!propertyValue.isObject()) {
|
920
|
+
return convertedStyles.setProperty(rt, propertyName.c_str(), propertyValue);
|
921
|
+
}
|
922
|
+
|
923
|
+
auto objValue = propertyValue.asObject(rt);
|
924
|
+
|
925
|
+
if (!objValue.isArray(rt)) {
|
926
|
+
return convertedStyles.setProperty(rt, propertyName.c_str(), propertyValue);
|
927
|
+
}
|
928
|
+
|
929
|
+
// parse nested arrays like boxShadow
|
930
|
+
auto arrValue = objValue.asArray(rt);
|
931
|
+
auto parsedArray = jsi::Array(rt, arrValue.length(rt));
|
932
|
+
|
933
|
+
helpers::iterateJSIArray(rt, arrValue, [&](size_t i, jsi::Value& nestedValue){
|
934
|
+
if (nestedValue.isObject()) {
|
935
|
+
jsi::Object obj = jsi::Object(rt);
|
936
|
+
|
937
|
+
helpers::enumerateJSIObject(rt, nestedValue.asObject(rt), [&](const std::string& propertyName, jsi::Value& propertyValue){
|
938
|
+
if (this->isColor(propertyName)) {
|
939
|
+
obj.setProperty(rt, propertyName.c_str(), state.parseColor(propertyValue));
|
940
|
+
|
941
|
+
return;
|
942
|
+
}
|
943
|
+
|
944
|
+
obj.setProperty(rt, propertyName.c_str(), propertyValue);
|
945
|
+
});
|
946
|
+
|
947
|
+
parsedArray.setValueAtIndex(rt, i, std::move(obj));
|
948
|
+
|
949
|
+
return;
|
950
|
+
}
|
951
|
+
|
952
|
+
if (this->isColor(propertyName)) {
|
953
|
+
parsedArray.setValueAtIndex(rt, i, jsi::Value(state.parseColor(nestedValue)));
|
954
|
+
|
955
|
+
return;
|
956
|
+
}
|
957
|
+
|
958
|
+
parsedArray.setValueAtIndex(rt, i, nestedValue);
|
959
|
+
});
|
960
|
+
|
961
|
+
return convertedStyles.setProperty(rt, propertyName.c_str(), parsedArray);
|
920
962
|
});
|
921
963
|
}
|
922
964
|
|
@@ -28,6 +28,7 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
28
28
|
...props
|
29
29
|
}, forwardedRef) => {
|
30
30
|
const storedRef = (0, _react.useRef)();
|
31
|
+
const scopedTheme = _specs.UnistylesShadowRegistry.getScopedTheme();
|
31
32
|
(0, _react.useLayoutEffect)(() => {
|
32
33
|
return () => {
|
33
34
|
if (storedRef.current) {
|
@@ -53,6 +54,8 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
53
54
|
},
|
54
55
|
style: state => {
|
55
56
|
const isPropStyleAFunction = typeof style === 'function';
|
57
|
+
const previousScopedTheme = _specs.UnistylesShadowRegistry.getScopedTheme();
|
58
|
+
_specs.UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
56
59
|
const unistyles = isPropStyleAFunction ? style.call(style, state) : getStyles(style);
|
57
60
|
if (!storedRef.current) {
|
58
61
|
return unistyles;
|
@@ -63,6 +66,7 @@ const Pressable = exports.Pressable = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
63
66
|
|
64
67
|
// @ts-expect-error - this is hidden from TS
|
65
68
|
_specs.UnistylesShadowRegistry.add(storedRef.current, unistyles);
|
69
|
+
_specs.UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
66
70
|
return unistyles;
|
67
71
|
}
|
68
72
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getStyles","styleProps","unistyleKey","keys","find","key","startsWith","uni__getStyles","Pressable","exports","forwardRef","variants","style","props","forwardedRef","storedRef","useRef","scopedTheme","UnistylesShadowRegistry","getScopedTheme","useLayoutEffect","current","remove","jsx","ref","isPropStyleAFunction","unistyles","pressed","add","passForwardedRef","state","previousScopedTheme","setScopedTheme"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings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,EAAE;QACLT,SAAS,CAACM,OAAO,GAAGG,GAAG;MAC3B;;MAEA;MACAN,8BAAuB,CAACU,GAAG,CAACb,SAAS,CAACM,OAAO,EAAEK,SAAS,CAAC;MAEzD,OAAO,IAAAG,sBAAgB,EAAChB,KAAK,EAAEW,GAAG,EAAEV,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEkB,KAAK,IAAI;MACZ,MAAML,oBAAoB,GAAG,OAAOb,KAAK,KAAK,UAAU;MACxD,MAAMmB,mBAAmB,GAAGb,8BAAuB,CAACC,cAAc,CAAC,CAAC;MAEpED,8BAAuB,CAACc,cAAc,CAACf,WAAW,CAAC;MAEnD,MAAMS,SAAS,GAAGD,oBAAoB,GAChCb,KAAK,CAACf,IAAI,CAACe,KAAK,EAAEkB,KAAK,CAAC,GACxB9B,SAAS,CAACY,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACM,OAAO,EAAE;QACpB,OAAOK,SAAS;MACpB;;MAEA;MACAR,8BAAuB,CAACI,MAAM,CAACP,SAAS,CAACM,OAAO,CAAC;;MAEjD;MACAH,8BAAuB,CAACU,GAAG,CAACb,SAAS,CAACM,OAAO,EAAEK,SAAS,CAAC;MAEzDR,8BAAuB,CAACc,cAAc,CAACD,mBAAmB,CAAC;MAE3D,OAAOL,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -21,7 +21,7 @@ HybridShadowRegistry.add = (handle, styles) => {
|
|
21
21
|
const stylesArray = Array.isArray(styles) ? styles.flat() : [styles];
|
22
22
|
|
23
23
|
// filter Reanimated styles and styles that are undefined
|
24
|
-
const filteredStyles = stylesArray.filter(style => !style?.initial?.updater).filter(style => style && Object.keys(style).length > 0).flat();
|
24
|
+
const filteredStyles = stylesArray.filter(style => !style?.initial?.updater).filter(style => style && Object.keys(style).length > 0).flat().filter(Boolean);
|
25
25
|
if (filteredStyles.length > 0) {
|
26
26
|
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles);
|
27
27
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","stylesArray","Array","isArray","flat","filteredStyles","filter","style","initial","updater","Object","keys","length","link","remove","unlink","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAeA,MAAMC,oBAAoB,GAAGC,qCAAY,CAACC,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACzED,MAAM,EAAEM,QAAQ,EAAEJ,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IAC3DD,MAAM,EAAEO,OAAO,EAAEC,OAAO,EAAEN,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACnED,MAAM,EAAES,UAAU,EAAEP,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEpE,IAAI,CAACA,IAAI,EAAE;IACP,MAAM,IAAIS,KAAK,CAAC,4EAA4EV,MAAM,EAAEE,wBAAwB,EAAES,WAAW,IAAI,SAAS,EAAE,CAAC;EAC7J;EAEA,OAAOV,IAAI;AACf,CAAC;AAEDL,oBAAoB,CAACgB,GAAG,GAAG,CAACZ,MAAM,EAAEa,MAAM,KAAK;EAC3C;EACA,IAAI,CAACb,MAAM,IAAI,CAACa,MAAM,EAAE;IACpB;EACJ;EAEA,MAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GACnCA,MAAM,CAACI,IAAI,CAAC,CAAC,GACb,CAACJ,MAAM,CAAC;;EAEd;EACA,MAAMK,cAAc,GAAGJ,WAAW,CAC7BK,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC,CACzCH,MAAM,CAACC,KAAK,IAAIA,KAAK,IAAIG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,GAAG,CAAC,CAAC,CACvDR,IAAI,CAAC,CAAC;
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","HybridShadowRegistry","NitroModules","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","stylesArray","Array","isArray","flat","filteredStyles","filter","style","initial","updater","Object","keys","length","Boolean","link","remove","unlink","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAeA,MAAMC,oBAAoB,GAAGC,qCAAY,CAACC,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACzED,MAAM,EAAEM,QAAQ,EAAEJ,wBAAwB,EAAEC,SAAS,EAAEF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,CAAAD,uBAAA,GAAGlC,oBAA4D","ignoreList":[]}
|
@@ -22,6 +22,7 @@ export const Pressable = /*#__PURE__*/forwardRef(({
|
|
22
22
|
...props
|
23
23
|
}, forwardedRef) => {
|
24
24
|
const storedRef = useRef();
|
25
|
+
const scopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
25
26
|
useLayoutEffect(() => {
|
26
27
|
return () => {
|
27
28
|
if (storedRef.current) {
|
@@ -47,6 +48,8 @@ export const Pressable = /*#__PURE__*/forwardRef(({
|
|
47
48
|
},
|
48
49
|
style: state => {
|
49
50
|
const isPropStyleAFunction = typeof style === 'function';
|
51
|
+
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme();
|
52
|
+
UnistylesShadowRegistry.setScopedTheme(scopedTheme);
|
50
53
|
const unistyles = isPropStyleAFunction ? style.call(style, state) : getStyles(style);
|
51
54
|
if (!storedRef.current) {
|
52
55
|
return unistyles;
|
@@ -57,6 +60,7 @@ export const Pressable = /*#__PURE__*/forwardRef(({
|
|
57
60
|
|
58
61
|
// @ts-expect-error - this is hidden from TS
|
59
62
|
UnistylesShadowRegistry.add(storedRef.current, unistyles);
|
63
|
+
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme);
|
60
64
|
return unistyles;
|
61
65
|
}
|
62
66
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useLayoutEffect","useRef","Pressable","NativePressableReactNative","passForwardedRef","UnistylesShadowRegistry","jsx","_jsx","getStyles","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","variants","style","props","forwardedRef","storedRef","current","remove","ref","isPropStyleAFunction","unistyles","call","pressed","add","state"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAClE,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,uBAAuB,QAAQ,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMrD,MAAMC,SAAS,GAAGA,CAACC,UAA+B,GAAG,CAAC,CAAC,KAAK;EACxD,MAAMC,WAAW,GAAGC,MAAM,CACrBC,IAAI,CAACH,UAAU,CAAC,CAChBI,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;EAE9C,IAAI,CAACL,WAAW,EAAE;IACd,OAAOD,UAAU;EACrB;EAEA,OAAO;IACH;IACA,GAAGA,UAAU,CAACC,WAAW,CAAC,CAACM,cAAc,CAAC,CAAC;IAC3C,CAACN,WAAW,GAAGD,UAAU,CAACC,WAAW;EACzC,CAAC;AACL,CAAC;AAED,OAAO,MAAMR,SAAS,gBAAGH,UAAU,CAAuB,CAAC;EAAEkB,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,KAAK;EACvG,MAAMC,SAAS,GAAGpB,MAAM,CAAc,CAAC;
|
1
|
+
{"version":3,"names":["React","forwardRef","useLayoutEffect","useRef","Pressable","NativePressableReactNative","passForwardedRef","UnistylesShadowRegistry","jsx","_jsx","getStyles","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","variants","style","props","forwardedRef","storedRef","scopedTheme","getScopedTheme","current","remove","ref","isPropStyleAFunction","unistyles","call","pressed","add","state","previousScopedTheme","setScopedTheme"],"sourceRoot":"../../../../src","sources":["components/native/Pressable.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAClE,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,uBAAuB,QAAQ,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMrD,MAAMC,SAAS,GAAGA,CAACC,UAA+B,GAAG,CAAC,CAA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BAAgB,CAACe,KAAK,EAAEO,GAAG,EAAEN,YAAY,CAAC;IACrD,CAAE;IACFF,KAAK,EAAEc,KAAK,IAAI;MACZ,MAAML,oBAAoB,GAAG,OAAOT,KAAK,KAAK,UAAU;MACxD,MAAMe,mBAAmB,GAAG5B,uBAAuB,CAACkB,cAAc,CAAC,CAAC;MAEpElB,uBAAuB,CAAC6B,cAAc,CAACZ,WAAW,CAAC;MAEnD,MAAMM,SAAS,GAAGD,oBAAoB,GAChCT,KAAK,CAACW,IAAI,CAACX,KAAK,EAAEc,KAAK,CAAC,GACxBxB,SAAS,CAACU,KAAuC,CAAC;MAExD,IAAI,CAACG,SAAS,CAACG,OAAO,EAAE;QACpB,OAAOI,SAAS;MACpB;;MAEA;MACAvB,uBAAuB,CAACoB,MAAM,CAACJ,SAAS,CAACG,OAAO,CAAC;;MAEjD;MACAnB,uBAAuB,CAAC0B,GAAG,CAACV,SAAS,CAACG,OAAO,EAAEI,SAAS,CAAC;MAEzDvB,uBAAuB,CAAC6B,cAAc,CAACD,mBAAmB,CAAC;MAE3D,OAAOL,SAAS;IACpB;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
@@ -17,7 +17,7 @@ HybridShadowRegistry.add = (handle, styles) => {
|
|
17
17
|
const stylesArray = Array.isArray(styles) ? styles.flat() : [styles];
|
18
18
|
|
19
19
|
// filter Reanimated styles and styles that are undefined
|
20
|
-
const filteredStyles = stylesArray.filter(style => !style?.initial?.updater).filter(style => style && Object.keys(style).length > 0).flat();
|
20
|
+
const filteredStyles = stylesArray.filter(style => !style?.initial?.updater).filter(style => style && Object.keys(style).length > 0).flat().filter(Boolean);
|
21
21
|
if (filteredStyles.length > 0) {
|
22
22
|
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles);
|
23
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","stylesArray","Array","isArray","flat","filteredStyles","filter","style","initial","updater","Object","keys","length","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAezD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACzED,MAAM,EAAEM,QAAQ,EAAEJ,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IAC3DD,MAAM,EAAEO,OAAO,EAAEC,OAAO,EAAEN,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACnED,MAAM,EAAES,UAAU,EAAEP,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEpE,IAAI,CAACA,IAAI,EAAE;IACP,MAAM,IAAIS,KAAK,CAAC,4EAA4EV,MAAM,EAAEE,wBAAwB,EAAES,WAAW,IAAI,SAAS,EAAE,CAAC;EAC7J;EAEA,OAAOV,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACe,GAAG,GAAG,CAACZ,MAAM,EAAEa,MAAM,KAAK;EAC3C;EACA,IAAI,CAACb,MAAM,IAAI,CAACa,MAAM,EAAE;IACpB;EACJ;EAEA,MAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GACnCA,MAAM,CAACI,IAAI,CAAC,CAAC,GACb,CAACJ,MAAM,CAAC;;EAEd;EACA,MAAMK,cAAc,GAAGJ,WAAW,CAC7BK,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC,CACzCH,MAAM,CAACC,KAAK,IAAIA,KAAK,IAAIG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,GAAG,CAAC,CAAC,CACvDR,IAAI,CAAC,CAAC;
|
1
|
+
{"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","_viewRef","viewRef","current","_nativeRef","Error","elementType","add","styles","stylesArray","Array","isArray","flat","filteredStyles","filter","style","initial","updater","Object","keys","length","Boolean","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAezD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACzED,MAAM,EAAEM,QAAQ,EAAEJ,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IAC3DD,MAAM,EAAEO,OAAO,EAAEC,OAAO,EAAEN,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACnED,MAAM,EAAES,UAAU,EAAEP,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEpE,IAAI,CAACA,IAAI,EAAE;IACP,MAAM,IAAIS,KAAK,CAAC,4EAA4EV,MAAM,EAAEE,wBAAwB,EAAES,WAAW,IAAI,SAAS,EAAE,CAAC;EAC7J;EAEA,OAAOV,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACe,GAAG,GAAG,CAACZ,MAAM,EAAEa,MAAM,KAAK;EAC3C;EACA,IAAI,CAACb,MAAM,IAAI,CAACa,MAAM,EAAE;IACpB;EACJ;EAEA,MAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GACnCA,MAAM,CAACI,IAAI,CAAC,CAAC,GACb,CAACJ,MAAM,CAAC;;EAEd;EACA,MAAMK,cAAc,GAAGJ,WAAW,CAC7BK,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,EAAEC,OAAO,EAAEC,OAAO,CAAC,CACzCH,MAAM,CAACC,KAAK,IAAIA,KAAK,IAAIG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,GAAG,CAAC,CAAC,CACvDR,IAAI,CAAC,CAAC,CACNE,MAAM,CAACO,OAAO,CAAC;EAEpB,IAAIR,cAAc,CAACO,MAAM,GAAG,CAAC,EAAE;IAC3B5B,oBAAoB,CAAC8B,IAAI,CAAC5B,uBAAuB,CAACC,MAAM,CAAC,EAAEkB,cAAc,CAAC;EAC9E;AACJ,CAAC;AAEDrB,oBAAoB,CAAC+B,MAAM,GAAG5B,MAAM,IAAI;EACpC,IAAI,CAACA,MAAM,EAAE;IACT;EACJ;EAEAH,oBAAoB,CAACgC,MAAM,CAAC9B,uBAAuB,CAACC,MAAM,CAAC,CAAC;AAChE,CAAC;AAQD,OAAO,MAAM8B,uBAAuB,GAAGjC,oBAA4D","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Pressable.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAwBjE,eAAO,MAAM,SAAS;eAnBP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"Pressable.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAwBjE,eAAO,MAAM,SAAS;eAnBP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BA4E7C,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/specs/ShadowRegistry/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE/D,UAAU,cAAe,SAAQ,2BAA2B;IAExD,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACzD,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAElC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,cAAc,IAAI,MAAM,GAAG,SAAS,CAAA;CACvC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/specs/ShadowRegistry/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE/D,UAAU,cAAe,SAAQ,2BAA2B;IAExD,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACzD,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAElC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,cAAc,IAAI,MAAM,GAAG,SAAS,CAAA;CACvC;AAiDD,KAAK,cAAc,GACb,KAAK,GACL,QAAQ,GACR,MAAM,GACN,QAAQ,CAAA;AAEd,eAAO,MAAM,uBAAuB,EAA2B,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -26,6 +26,7 @@ const getStyles = (styleProps: Record<string, any> = {}) => {
|
|
26
26
|
|
27
27
|
export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ...props }, forwardedRef) => {
|
28
28
|
const storedRef = useRef<View | null>()
|
29
|
+
const scopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
29
30
|
|
30
31
|
useLayoutEffect(() => {
|
31
32
|
return () => {
|
@@ -56,6 +57,10 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
56
57
|
}}
|
57
58
|
style={state => {
|
58
59
|
const isPropStyleAFunction = typeof style === 'function'
|
60
|
+
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
61
|
+
|
62
|
+
UnistylesShadowRegistry.setScopedTheme(scopedTheme)
|
63
|
+
|
59
64
|
const unistyles = isPropStyleAFunction
|
60
65
|
? style.call(style, state)
|
61
66
|
: getStyles(style as unknown as Record<string, any>)
|
@@ -70,6 +75,8 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
70
75
|
// @ts-expect-error - this is hidden from TS
|
71
76
|
UnistylesShadowRegistry.add(storedRef.current, unistyles)
|
72
77
|
|
78
|
+
UnistylesShadowRegistry.setScopedTheme(previousScopedTheme)
|
79
|
+
|
73
80
|
return unistyles
|
74
81
|
}}
|
75
82
|
/>
|
@@ -45,6 +45,7 @@ HybridShadowRegistry.add = (handle, styles) => {
|
|
45
45
|
.filter(style => !style?.initial?.updater)
|
46
46
|
.filter(style => style && Object.keys(style).length > 0)
|
47
47
|
.flat()
|
48
|
+
.filter(Boolean)
|
48
49
|
|
49
50
|
if (filteredStyles.length > 0) {
|
50
51
|
HybridShadowRegistry.link(findShadowNodeForHandle(handle), filteredStyles)
|