react-native-unistyles 3.0.17 → 3.0.19
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 +8 -2
- package/cxx/core/HostUnistyle.cpp +10 -4
- package/cxx/core/HostUnistyle.h +4 -2
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +4 -2
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +4 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +1 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -0
- package/nitrogen/generated/ios/swift/Dimensions.swift +1 -0
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -1
- package/nitrogen/generated/ios/swift/Insets.swift +1 -0
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +1 -0
- package/package.json +3 -3
- package/plugin/index.js +3 -2
- package/src/core/withUnistyles/withUnistyles.native.tsx +8 -4
package/README.md
CHANGED
|
@@ -21,14 +21,14 @@ yarn add react-native-unistyles
|
|
|
21
21
|
Install dependencies:
|
|
22
22
|
|
|
23
23
|
```shell
|
|
24
|
-
yarn add react-native-edge-to-edge react-native-nitro-modules@0.31.
|
|
24
|
+
yarn add react-native-edge-to-edge react-native-nitro-modules@0.31.10
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
> To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
|
|
28
28
|
|
|
29
29
|
| react-native-unistyles | react-native-nitro-modules |
|
|
30
30
|
|------------------------|----------------------------|
|
|
31
|
-
| 3.0.0 | 0.31.
|
|
31
|
+
| 3.0.0 | 0.31.10 |
|
|
32
32
|
|
|
33
33
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
|
34
34
|
|
|
@@ -77,6 +77,12 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
|
77
77
|
<a href="https://github.com/rauchg">
|
|
78
78
|
<img src="https://avatars.githubusercontent.com/u/13041?v=4" height="70px" width="70px" alt="rauchg" />
|
|
79
79
|
</a>
|
|
80
|
+
<a href="https://github.com/oliverloops">
|
|
81
|
+
<img src="https://avatars.githubusercontent.com/u/33361399?v=4" height="70px" width="70px" alt="oliverloops" />
|
|
82
|
+
</a>
|
|
83
|
+
<a href="https://github.com/cargurus-oss-fund">
|
|
84
|
+
<img src="https://avatars.githubusercontent.com/u/108300759?v=4" height="70px" width="70px" alt="cargurus-oss-fund" />
|
|
85
|
+
</a>
|
|
80
86
|
|
|
81
87
|
## Past sponsors
|
|
82
88
|
|
|
@@ -17,6 +17,12 @@ std::vector<jsi::PropNameID> HostUnistyle::getPropertyNames(jsi::Runtime& rt) {
|
|
|
17
17
|
return propertyNames;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
HostUnistyle::~HostUnistyle() {
|
|
21
|
+
if (this->_ownsStyleSheet) {
|
|
22
|
+
this->_stylesheet->unistyles.clear();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
jsi::Value HostUnistyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId) {
|
|
21
27
|
auto propertyName = propNameId.utf8(rt);
|
|
22
28
|
|
|
@@ -92,23 +98,23 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
|
|
|
92
98
|
this->_stylesheet->type,
|
|
93
99
|
jsi::Value(rt, this->_stylesheet->rawValue).asObject(rt)
|
|
94
100
|
);
|
|
95
|
-
|
|
101
|
+
|
|
96
102
|
parser.buildUnistyles(rt, stylesheetCopy);
|
|
97
103
|
parser.parseUnistyles(rt, stylesheetCopy);
|
|
98
|
-
|
|
104
|
+
|
|
99
105
|
helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants, stylesheetCopy](const std::string& name, jsi::Value& value){
|
|
100
106
|
if (name == helpers::ADD_VARIANTS_FN || !stylesheetCopy->unistyles.contains(name)) {
|
|
101
107
|
return;
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
auto unistyle = stylesheetCopy->unistyles[name];
|
|
105
|
-
|
|
111
|
+
|
|
106
112
|
if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) {
|
|
107
113
|
parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt);
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
|
|
111
|
-
auto style = std::make_shared<core::HostUnistyle>(stylesheetCopy, this->_unistylesRuntime, variants);
|
|
117
|
+
auto style = std::make_shared<core::HostUnistyle>(stylesheetCopy, this->_unistylesRuntime, variants, true);
|
|
112
118
|
auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
|
|
113
119
|
|
|
114
120
|
return styleHostObject;
|
package/cxx/core/HostUnistyle.h
CHANGED
|
@@ -9,8 +9,9 @@ namespace margelo::nitro::unistyles::core {
|
|
|
9
9
|
using Variants = std::vector<std::pair<std::string, std::string>>;
|
|
10
10
|
|
|
11
11
|
struct JSI_EXPORT HostUnistyle : public jsi::HostObject {
|
|
12
|
-
HostUnistyle(std::shared_ptr<StyleSheet> stylesheet, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Variants& variants)
|
|
13
|
-
: _stylesheet(stylesheet), _unistylesRuntime{unistylesRuntime}, _variants{std::move(variants)} {};
|
|
12
|
+
HostUnistyle(std::shared_ptr<StyleSheet> stylesheet, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Variants& variants, bool ownsStyleSheet = false)
|
|
13
|
+
: _stylesheet(stylesheet), _unistylesRuntime{unistylesRuntime}, _variants{std::move(variants)}, _ownsStyleSheet(ownsStyleSheet) {};
|
|
14
|
+
~HostUnistyle();
|
|
14
15
|
|
|
15
16
|
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt);
|
|
16
17
|
jsi::Value get(jsi::Runtime& rt, const jsi::PropNameID& propNameId);
|
|
@@ -19,6 +20,7 @@ struct JSI_EXPORT HostUnistyle : public jsi::HostObject {
|
|
|
19
20
|
jsi::Function createAddVariantsProxyFunction(jsi::Runtime& rt);
|
|
20
21
|
|
|
21
22
|
private:
|
|
23
|
+
bool _ownsStyleSheet;
|
|
22
24
|
Variants _variants;
|
|
23
25
|
std::shared_ptr<StyleSheet> _stylesheet;
|
|
24
26
|
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_utils","_useProxifiedUnistyles","_warn","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","withUnistyles","Component","mappings","getSecrets","styleProps","styles","Array","isArray","flat","secrets","filter","Boolean","reduce","acc","style","unistyleKey","keys","find","key","startsWith","concat","uni__getStyles","uni__dependencies","secret","assign","dependencies","flatMap","forwardRef","props","ref","narrowedProps","NativeComponent","maybeWarnAboutMultipleUnistyles","displayName","name","contentContainerStyle","scopedTheme","useRef","UnistylesShadowRegistry","getScopedTheme","proxifiedRuntime","proxifiedTheme","addDependencies","useProxifiedUnistyles","current","useEffect","styleSecrets","contentContainerStyleSecrets","from","Set","mappingsKey","mappingsProps","uniPropsKey","unistyleProps","uniProps","finalProps","deepMergeObjects","jsx","exports"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA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ard","require","_specs","_utils","_useProxifiedUnistyles","_warn","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","withUnistyles","Component","mappings","getSecrets","styleProps","styles","Array","isArray","flat","secrets","filter","Boolean","reduce","acc","style","unistyleKey","keys","find","key","startsWith","concat","uni__getStyles","uni__dependencies","secret","assign","dependencies","flatMap","forwardRef","props","ref","narrowedProps","NativeComponent","maybeWarnAboutMultipleUnistyles","displayName","name","contentContainerStyle","scopedTheme","useRef","UnistylesShadowRegistry","getScopedTheme","proxifiedRuntime","proxifiedTheme","addDependencies","useProxifiedUnistyles","current","useEffect","styleSecrets","contentContainerStyleSecrets","from","Set","mappingsKey","mappingsProps","uniPropsKey","unistyleProps","uniProps","finalProps","deepMergeObjects","jsx","exports"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAA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CAAC,CAAC,CAAC,CAAC;IACtH,CAAC,EAAE,CAACK,aAAa,CAAChB,KAAK,EAAEgB,aAAa,CAACK,qBAAqB,CAAC,CAAC;IAE9D,MAAM;MAAEjB,GAAG,EAAEgC,WAAW;MAAE,GAAGC;IAAc,CAAC,GAAGjD,QAAQ,GAAGA,QAAQ,CAACuC,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzG,MAAM;MAAEtB,GAAG,EAAEkC,WAAW;MAAE,GAAGC;IAAc,CAAC,GAAGvB,aAAa,CAACwB,QAAQ,GAAGxB,aAAa,CAACwB,QAAQ,CAACb,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAErI,MAAMM,YAAY,GAAG3C,UAAU,CAAC2B,aAAa,CAAChB,KAAK,CAAC;IACpD,MAAMiC,4BAA4B,GAAG5C,UAAU,CAAC2B,aAAa,CAACK,qBAAqB,CAAC;IAEpF,MAAMoB,UAAU,GAAG;MACf,GAAG,IAAAC,uBAAgB,EAACL,aAAa,EAAEE,aAAa,EAAEzB,KAAK,CAAC;MACxD,IAAGE,aAAa,CAAChB,KAAK,GAAG;QACrBA,KAAK,EAAEgC,YAAY,CAACzC;MACxB,CAAC,GAAG,CAAC,CAAC;MACN,IAAGyB,aAAa,CAACK,qBAAqB,GAAG;QACrCA,qBAAqB,EAAEY,4BAA4B,CAAC1C;MACxD,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;IAER,oBACI,IAAAzB,WAAA,CAAA6E,GAAA,EAAC1B,eAAe;MAAA,GAERwB,UAAU;MACd1B,GAAG,EAAEA;IAAI,GAFJuB,WAAW,IAAIF,WAGvB,CAAC;EAEV,CAAC,CAAC;AACN,CAAC;AAAAQ,OAAA,CAAA1D,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","useRef","UnistylesShadowRegistry","deepMergeObjects","useProxifiedUnistyles","maybeWarnAboutMultipleUnistyles","jsx","_jsx","withUnistyles","Component","mappings","getSecrets","styleProps","styles","Array","isArray","flat","secrets","filter","Boolean","reduce","acc","style","unistyleKey","Object","keys","find","key","startsWith","concat","uni__getStyles","uni__dependencies","secret","assign","dependencies","flatMap","props","ref","narrowedProps","NativeComponent","displayName","name","contentContainerStyle","scopedTheme","getScopedTheme","proxifiedRuntime","proxifiedTheme","addDependencies","current","styleSecrets","contentContainerStyleSecrets","from","Set","mappingsKey","mappingsProps","uniPropsKey","unistyleProps","uniProps","finalProps"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useRef","UnistylesShadowRegistry","deepMergeObjects","useProxifiedUnistyles","maybeWarnAboutMultipleUnistyles","jsx","_jsx","withUnistyles","Component","mappings","getSecrets","styleProps","styles","Array","isArray","flat","secrets","filter","Boolean","reduce","acc","style","unistyleKey","Object","keys","find","key","startsWith","concat","uni__getStyles","uni__dependencies","secret","assign","dependencies","flatMap","props","ref","narrowedProps","NativeComponent","displayName","name","contentContainerStyle","scopedTheme","getScopedTheme","proxifiedRuntime","proxifiedTheme","addDependencies","current","styleSecrets","contentContainerStyleSecrets","from","Set","mappingsKey","mappingsProps","uniPropsKey","unistyleProps","uniProps","finalProps"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAoE,OAAO;AACxH,SAAkCC,uBAAuB,QAAQ,aAAa;AAE9E,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,+BAA+B,QAAQ,SAAS;;AAGzD;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAaA,OAAO,MAAMC,aAAa,GAAGA,CAAkEC,SAA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AAGvD,gBAAgB,CAACmD,aAAa,EAAEE,aAAa,EAAEpB,KAAK,CAAC;MACxD,IAAGE,aAAa,CAAChB,KAAK,GAAG;QACrBA,KAAK,EAAE2B,YAAY,CAACpC;MACxB,CAAC,GAAG,CAAC,CAAC;MACN,IAAGyB,aAAa,CAACI,qBAAqB,GAAG;QACrCA,qBAAqB,EAAEQ,4BAA4B,CAACrC;MACxD,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;IAER,oBACIN,IAAA,CAACgC,eAAe;MAAA,GAERmB,UAAU;MACdrB,GAAG,EAAEA;IAAI,GAFJkB,WAAW,IAAIF,WAGvB,CAAC;EAEV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ComponentProps } from 'react';
|
|
2
2
|
import type { Mappings } from './types';
|
|
3
3
|
type GenericComponentProps<P> = ComponentProps<P>;
|
|
4
|
-
export declare const withUnistyles: <TComponent, TMappings extends GenericComponentProps<TComponent>>(Component: TComponent, mappings?: Mappings<TMappings>) => React.ForwardRefExoticComponent<
|
|
4
|
+
export declare const withUnistyles: <TComponent, TMappings extends GenericComponentProps<TComponent>>(Component: TComponent, mappings?: Mappings<TMappings>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Partial<React.ComponentProps<TComponent>> & {
|
|
5
|
+
uniProps?: Mappings<React.ComponentProps<TComponent>>;
|
|
6
|
+
}> & React.RefAttributes<React.ComponentRef<TComponent>>>;
|
|
5
7
|
export {};
|
|
6
8
|
//# sourceMappingURL=withUnistyles.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withUnistyles.native.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.native.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"withUnistyles.native.d.ts","sourceRoot":"","sources":["../../../../../src/core/withUnistyles/withUnistyles.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiC,KAAK,cAAc,EAAyC,MAAM,OAAO,CAAA;AAMxH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGvC,KAAK,qBAAqB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;AAcjD,eAAO,MAAM,aAAa,GAAI,UAAU,EAAE,SAAS,SAAS,qBAAqB,CAAC,UAAU,CAAC,EAAE,WAAW,UAAU,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC;eAGjI,QAAQ,kCAAQ;yDA+ElC,CAAA"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include "UnistylesNativeMiniRuntime.hpp"
|
|
14
14
|
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
16
|
#include "JUnistylesNativeMiniRuntime.hpp"
|
|
16
17
|
#include "ColorScheme.hpp"
|
|
17
18
|
#include "JColorScheme.hpp"
|
|
@@ -46,7 +47,7 @@ namespace margelo::nitro::unistyles {
|
|
|
46
47
|
/**
|
|
47
48
|
* An implementation of Func_void_UnistylesNativeMiniRuntime that is backed by a C++ implementation (using `std::function<...>`)
|
|
48
49
|
*/
|
|
49
|
-
|
|
50
|
+
class JFunc_void_UnistylesNativeMiniRuntime_cxx final: public jni::HybridClass<JFunc_void_UnistylesNativeMiniRuntime_cxx, JFunc_void_UnistylesNativeMiniRuntime> {
|
|
50
51
|
public:
|
|
51
52
|
static jni::local_ref<JFunc_void_UnistylesNativeMiniRuntime::javaobject> fromCpp(const std::function<void(const UnistylesNativeMiniRuntime& /* miniRuntime */)>& func) {
|
|
52
53
|
return JFunc_void_UnistylesNativeMiniRuntime_cxx::newObjectCxxArgs(func);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include <vector>
|
|
15
15
|
#include "UnistylesNativeMiniRuntime.hpp"
|
|
16
16
|
#include <functional>
|
|
17
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
18
|
#include "JUnistyleDependency.hpp"
|
|
18
19
|
#include "JUnistylesNativeMiniRuntime.hpp"
|
|
19
20
|
#include "ColorScheme.hpp"
|
|
@@ -47,7 +48,8 @@ namespace margelo::nitro::unistyles {
|
|
|
47
48
|
jni::local_ref<jni::JArrayClass<JUnistyleDependency>> __array = jni::JArrayClass<JUnistyleDependency>::newArray(__size);
|
|
48
49
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
49
50
|
const auto& __element = dependencies[__i];
|
|
50
|
-
|
|
51
|
+
auto __elementJni = JUnistyleDependency::fromCpp(__element);
|
|
52
|
+
__array->setElement(__i, *__elementJni);
|
|
51
53
|
}
|
|
52
54
|
return __array;
|
|
53
55
|
}(), JUnistylesNativeMiniRuntime::fromCpp(miniRuntime));
|
|
@@ -57,7 +59,7 @@ namespace margelo::nitro::unistyles {
|
|
|
57
59
|
/**
|
|
58
60
|
* An implementation of Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime that is backed by a C++ implementation (using `std::function<...>`)
|
|
59
61
|
*/
|
|
60
|
-
|
|
62
|
+
class JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime_cxx final: public jni::HybridClass<JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime_cxx, JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime> {
|
|
61
63
|
public:
|
|
62
64
|
static jni::local_ref<JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime::javaobject> fromCpp(const std::function<void(const std::vector<UnistyleDependency>& /* dependencies */, const UnistylesNativeMiniRuntime& /* miniRuntime */)>& func) {
|
|
63
65
|
return JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime_cxx::newObjectCxxArgs(func);
|
|
@@ -35,6 +35,7 @@ namespace margelo::nitro::unistyles { enum class UnistyleDependency; }
|
|
|
35
35
|
#include <vector>
|
|
36
36
|
#include <functional>
|
|
37
37
|
#include "JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp"
|
|
38
|
+
#include <NitroModules/JNICallable.hpp>
|
|
38
39
|
#include "JUnistyleDependency.hpp"
|
|
39
40
|
#include "JFunc_void_UnistylesNativeMiniRuntime.hpp"
|
|
40
41
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import Foundation
|
|
8
9
|
import NitroModules
|
|
9
10
|
|
|
10
|
-
|
|
11
11
|
/**
|
|
12
12
|
* Wraps a Swift `(_ miniRuntime: UnistylesNativeMiniRuntime) -> Void` as a class.
|
|
13
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import Foundation
|
|
8
9
|
import NitroModules
|
|
9
10
|
|
|
10
|
-
|
|
11
11
|
/**
|
|
12
12
|
* Wraps a Swift `(_ dependencies: [UnistyleDependency], _ miniRuntime: UnistylesNativeMiniRuntime) -> Void` as a class.
|
|
13
13
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.19",
|
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "NODE_ENV=babel-test jest ./plugin",
|
|
@@ -146,11 +146,11 @@
|
|
|
146
146
|
"husky": "9.1.7",
|
|
147
147
|
"jest": "29.7.0",
|
|
148
148
|
"metro-react-native-babel-preset": "0.77.0",
|
|
149
|
-
"nitrogen": "0.31.
|
|
149
|
+
"nitrogen": "0.31.10",
|
|
150
150
|
"react": "19.1.0",
|
|
151
151
|
"react-native": "0.79.2",
|
|
152
152
|
"react-native-builder-bob": "0.40.10",
|
|
153
|
-
"react-native-nitro-modules": "0.31.
|
|
153
|
+
"react-native-nitro-modules": "0.31.10",
|
|
154
154
|
"react-native-reanimated": "3.17.5",
|
|
155
155
|
"react-native-web": "0.20.0",
|
|
156
156
|
"react-test-renderer": "19.1.0",
|
package/plugin/index.js
CHANGED
|
@@ -251,7 +251,8 @@ function toUnistylesDependency(dependency) {
|
|
|
251
251
|
case "themeName": {
|
|
252
252
|
return UnistyleDependency.ThemeName;
|
|
253
253
|
}
|
|
254
|
-
case "adaptiveThemes":
|
|
254
|
+
case "adaptiveThemes":
|
|
255
|
+
case "hasAdaptiveThemes": {
|
|
255
256
|
return UnistyleDependency.AdaptiveThemes;
|
|
256
257
|
}
|
|
257
258
|
case "breakpoint": {
|
|
@@ -679,7 +680,7 @@ function addDependencies(state, styleName, unistyle, detectedDependencies) {
|
|
|
679
680
|
target.properties.push(
|
|
680
681
|
t4.objectProperty(
|
|
681
682
|
t4.identifier("uni__dependencies"),
|
|
682
|
-
t4.arrayExpression(uniqueDependencies.filter((dep) => dep !== void 0).map((dep) => t4.numericLiteral(dep)))
|
|
683
|
+
t4.arrayExpression(uniqueDependencies.filter((dep) => dep !== void 0 && dep !== null).map((dep) => t4.numericLiteral(dep)))
|
|
683
684
|
)
|
|
684
685
|
);
|
|
685
686
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { forwardRef, useEffect, type
|
|
1
|
+
import React, { forwardRef, useEffect, useRef, type ComponentProps, type ComponentRef, type ComponentType } from 'react'
|
|
2
2
|
import { type UnistyleDependency, UnistylesShadowRegistry } from '../../specs'
|
|
3
|
-
import type { UnistylesTheme } from '../../types'
|
|
3
|
+
import type { UnistylesTheme, UnistylesValues } from '../../types'
|
|
4
4
|
import { deepMergeObjects } from '../../utils'
|
|
5
5
|
import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
|
|
6
6
|
import { maybeWarnAboutMultipleUnistyles } from '../warn'
|
|
@@ -26,6 +26,10 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
26
26
|
type PropsWithUnistyles = Partial<TProps> & {
|
|
27
27
|
uniProps?: Mappings<TProps>
|
|
28
28
|
}
|
|
29
|
+
type UnistyleStyles = {
|
|
30
|
+
style?: UnistylesValues,
|
|
31
|
+
contentContainerStyle?: UnistylesValues
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
const getSecrets = (styleProps: Record<string, any> = {}): MappedSecrets => {
|
|
31
35
|
const styles = Array.isArray(styleProps)
|
|
@@ -57,7 +61,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
return forwardRef<GenericComponentRef<TComponent>, PropsWithUnistyles>((props, ref) => {
|
|
60
|
-
const narrowedProps = props as PropsWithUnistyles
|
|
64
|
+
const narrowedProps = props as PropsWithUnistyles & UnistyleStyles
|
|
61
65
|
const NativeComponent = Component as ComponentType
|
|
62
66
|
|
|
63
67
|
// @ts-ignore we don't know the type of the component
|
|
@@ -94,7 +98,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
|
94
98
|
return (
|
|
95
99
|
<NativeComponent
|
|
96
100
|
key={uniPropsKey || mappingsKey}
|
|
97
|
-
{...finalProps
|
|
101
|
+
{...finalProps}
|
|
98
102
|
ref={ref}
|
|
99
103
|
/>
|
|
100
104
|
)
|