react-native-unistyles 3.0.21 → 3.0.23
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 +11 -7
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +16 -2
- package/cxx/parser/Parser.cpp +166 -13
- package/cxx/shadowTree/ShadowTreeManager.cpp +14 -5
- 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_UnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +8 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +2 -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/ColorScheme.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.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/Orientation.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +1 -1
- package/nitrogen/generated/android/unistyles+autolinking.gradle +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.cpp +1 -1
- package/nitrogen/generated/android/unistylesOnLoad.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +7 -1
- package/nitrogen/generated/ios/swift/ColorScheme.swift +1 -1
- package/nitrogen/generated/ios/swift/Dimensions.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +3 -4
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +9 -2
- package/nitrogen/generated/ios/swift/Insets.swift +1 -2
- package/nitrogen/generated/ios/swift/Orientation.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +1 -1
- package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +1 -2
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
- package/package.json +3 -3
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.
|
|
24
|
+
yarn add react-native-edge-to-edge react-native-nitro-modules@0.33.8
|
|
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
|
+
| 3.0.0 | 0.33.8 |
|
|
32
32
|
|
|
33
33
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
|
34
34
|
|
|
@@ -59,9 +59,6 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
|
59
59
|
<a href="https://galaxies.dev">
|
|
60
60
|
<img src="https://avatars.githubusercontent.com/u/118431096?s=200&v=4" height="70px" width="70px" alt="galaxies-dev" />
|
|
61
61
|
</a>
|
|
62
|
-
<a href="https://github.com/biw">
|
|
63
|
-
<img src="https://avatars.githubusercontent.com/u/6139501?v=4" height="70px" width="70px" alt="biw" />
|
|
64
|
-
</a>
|
|
65
62
|
<a href="https://github.com/ryanlanciaux">
|
|
66
63
|
<img src="https://avatars.githubusercontent.com/u/85041?v=4" height="70px" width="70px" alt="ryanlanciaux" />
|
|
67
64
|
</a>
|
|
@@ -71,10 +68,11 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
|
71
68
|
<a href="https://github.com/kerwanp">
|
|
72
69
|
<img src="https://avatars.githubusercontent.com/u/36955373?v=4" height="70px" width="70px" alt="kerwanp" />
|
|
73
70
|
</a>
|
|
74
|
-
<a href="https://github.com/
|
|
75
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
71
|
+
<a href="https://github.com/andkindness">
|
|
72
|
+
<img src="https://avatars.githubusercontent.com/u/143941782?v=4" height="70px" width="70px" alt="andkindness" />
|
|
76
73
|
</a>
|
|
77
74
|
|
|
75
|
+
|
|
78
76
|
## Past sponsors
|
|
79
77
|
|
|
80
78
|
<a href="https://github.com/kmartinezmedia">
|
|
@@ -143,6 +141,12 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
|
143
141
|
<a href="https://github.com/rauchg">
|
|
144
142
|
<img src="https://avatars.githubusercontent.com/u/13041?v=4" height="60px" width="60px" alt="rauchg" />
|
|
145
143
|
</a>
|
|
144
|
+
<a href="https://github.com/oliverloops">
|
|
145
|
+
<img src="https://avatars.githubusercontent.com/u/33361399?v=4" height="60px" width="60px" alt="oliverloops" />
|
|
146
|
+
</a>
|
|
147
|
+
<a href="https://github.com/biw">
|
|
148
|
+
<img src="https://avatars.githubusercontent.com/u/6139501?v=4" height="60px" width="60px" alt="biw" />
|
|
149
|
+
</a>
|
|
146
150
|
|
|
147
151
|
## Sponsor my work
|
|
148
152
|
|
|
@@ -91,13 +91,27 @@ class NativePlatformInsets(
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
val insets = insetsCompat.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
|
94
|
+
val imeInsetValue = insetsCompat.getInsets(WindowInsetsCompat.Type.ime()).bottom
|
|
95
|
+
|
|
96
|
+
// When a keyboard management library (e.g. react-native-keyboard-controller) is active,
|
|
97
|
+
// systemBars().bottom can get polluted with the IME height on certain interactions
|
|
98
|
+
// (like double-tapping to select text). Detect this by checking if systemBars bottom
|
|
99
|
+
// is >= IME bottom (normally systemBars bottom is just the nav bar, much smaller than IME).
|
|
100
|
+
// Fall back to getInsetsIgnoringVisibility which returns stable nav bar values.
|
|
101
|
+
val bottomInset = if (imeInsetValue > 0 && insets.bottom >= imeInsetValue) {
|
|
102
|
+
insetsCompat.getInsetsIgnoringVisibility(
|
|
103
|
+
WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.displayCutout()
|
|
104
|
+
).bottom
|
|
105
|
+
} else {
|
|
106
|
+
insets.bottom
|
|
107
|
+
}
|
|
94
108
|
|
|
95
109
|
// Android 10 and below - set bottom insets to 0 while keyboard is visible and use default bottom insets otherwise
|
|
96
110
|
// Android 11 and above - animate bottom insets while keyboard is appearing and disappearing
|
|
97
111
|
val imeInsets = when {
|
|
98
112
|
animatedBottomInsets != null && Build.VERSION.SDK_INT >= 30 -> animatedBottomInsets
|
|
99
113
|
Build.VERSION.SDK_INT < 30 -> {
|
|
100
|
-
val nextBottomInset =
|
|
114
|
+
val nextBottomInset = imeInsetValue - bottomInset
|
|
101
115
|
maxOf(nextBottomInset, 0).toDouble()
|
|
102
116
|
}
|
|
103
117
|
else -> 0.0
|
|
@@ -107,7 +121,7 @@ class NativePlatformInsets(
|
|
|
107
121
|
|
|
108
122
|
this._insets = Insets(
|
|
109
123
|
statusBarTopInset.toDouble(),
|
|
110
|
-
|
|
124
|
+
bottomInset.toDouble(),
|
|
111
125
|
insets.left.toDouble(),
|
|
112
126
|
insets.right.toDouble(),
|
|
113
127
|
imeInsets
|
package/cxx/parser/Parser.cpp
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#include "Parser.h"
|
|
2
2
|
#include "UnistyleWrapper.h"
|
|
3
|
+
#include <iomanip>
|
|
4
|
+
#include <sstream>
|
|
5
|
+
#include <react/renderer/css/CSSFilter.h>
|
|
6
|
+
#include <react/renderer/css/CSSValueParser.h>
|
|
3
7
|
|
|
4
8
|
using namespace margelo::nitro::unistyles;
|
|
5
9
|
using namespace facebook;
|
|
@@ -7,6 +11,59 @@ using namespace facebook::react;
|
|
|
7
11
|
|
|
8
12
|
using Variants = std::vector<std::pair<std::string, std::string>>;
|
|
9
13
|
|
|
14
|
+
namespace {
|
|
15
|
+
|
|
16
|
+
bool isSupportedLength(const CSSLength& length) {
|
|
17
|
+
return length.unit == CSSLengthUnit::Px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
std::string cssColorToRgbaString(const CSSColor& color) {
|
|
21
|
+
std::ostringstream stream;
|
|
22
|
+
|
|
23
|
+
stream << "rgba("
|
|
24
|
+
<< static_cast<int>(color.r) << ", "
|
|
25
|
+
<< static_cast<int>(color.g) << ", "
|
|
26
|
+
<< static_cast<int>(color.b) << ", "
|
|
27
|
+
<< std::fixed << std::setprecision(3)
|
|
28
|
+
<< (static_cast<float>(color.a) / 255.0f)
|
|
29
|
+
<< ")";
|
|
30
|
+
|
|
31
|
+
return stream.str();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
std::optional<jsi::Object> parseDropShadowString(jsi::Runtime& rt, const std::string& dropShadowString) {
|
|
35
|
+
auto maybeParsedDropShadow = parseCSSProperty<CSSDropShadowFilter>(std::string("drop-shadow(") + dropShadowString + ")");
|
|
36
|
+
|
|
37
|
+
if (!std::holds_alternative<CSSDropShadowFilter>(maybeParsedDropShadow)) {
|
|
38
|
+
return std::nullopt;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
auto parsedDropShadow = std::get<CSSDropShadowFilter>(maybeParsedDropShadow);
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
!isSupportedLength(parsedDropShadow.offsetX) ||
|
|
45
|
+
!isSupportedLength(parsedDropShadow.offsetY) ||
|
|
46
|
+
!isSupportedLength(parsedDropShadow.standardDeviation)
|
|
47
|
+
) {
|
|
48
|
+
return std::nullopt;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
jsi::Object shadowObject(rt);
|
|
52
|
+
|
|
53
|
+
shadowObject.setProperty(rt, "offsetX", parsedDropShadow.offsetX.value);
|
|
54
|
+
shadowObject.setProperty(rt, "offsetY", parsedDropShadow.offsetY.value);
|
|
55
|
+
shadowObject.setProperty(rt, "standardDeviation", parsedDropShadow.standardDeviation.value);
|
|
56
|
+
shadowObject.setProperty(
|
|
57
|
+
rt,
|
|
58
|
+
"color",
|
|
59
|
+
jsi::String::createFromUtf8(rt, cssColorToRgbaString(parsedDropShadow.color))
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return shadowObject;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
10
67
|
// called only once while processing StyleSheet.create
|
|
11
68
|
void parser::Parser::buildUnistyles(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet) {
|
|
12
69
|
jsi::Object unwrappedStyleSheet = this->unwrapStyleSheet(rt, styleSheet, std::nullopt);
|
|
@@ -651,8 +708,42 @@ jsi::Value parser::Parser::parseFilters(jsi::Runtime &rt, Unistyle::Shared unist
|
|
|
651
708
|
|
|
652
709
|
auto parsedResult = this->parseSecondLevel(rt, unistyle, value);
|
|
653
710
|
|
|
711
|
+
if (!parsedResult.isObject()) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
auto parsedResultObject = parsedResult.asObject(rt);
|
|
716
|
+
auto filterPropertyNames = parsedResultObject.getPropertyNames(rt);
|
|
717
|
+
auto filterPropertyCount = filterPropertyNames.size(rt);
|
|
718
|
+
|
|
719
|
+
for (size_t index = 0; index < filterPropertyCount; index++) {
|
|
720
|
+
auto filterName = filterPropertyNames.getValueAtIndex(rt, index).asString(rt).utf8(rt);
|
|
721
|
+
|
|
722
|
+
if (filterName != "dropShadow") {
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
auto filterValue = parsedResultObject.getProperty(rt, filterName.c_str());
|
|
727
|
+
|
|
728
|
+
if (filterValue.isString()) {
|
|
729
|
+
auto maybeParsedDropShadow = parseDropShadowString(rt, filterValue.asString(rt).utf8(rt));
|
|
730
|
+
|
|
731
|
+
if (!maybeParsedDropShadow.has_value()) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
auto dropShadowObject = std::move(maybeParsedDropShadow.value());
|
|
736
|
+
parsedResultObject.setProperty(rt, filterName.c_str(), std::move(dropShadowObject));
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (!filterValue.isObject()) {
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
654
745
|
// take only one filter per object
|
|
655
|
-
jsi::Array propertyNames =
|
|
746
|
+
jsi::Array propertyNames = parsedResultObject.getPropertyNames(rt);
|
|
656
747
|
size_t length = propertyNames.size(rt);
|
|
657
748
|
|
|
658
749
|
// ignore no filters
|
|
@@ -660,7 +751,7 @@ jsi::Value parser::Parser::parseFilters(jsi::Runtime &rt, Unistyle::Shared unist
|
|
|
660
751
|
return;
|
|
661
752
|
}
|
|
662
753
|
|
|
663
|
-
parsedFilters.emplace_back(std::move(
|
|
754
|
+
parsedFilters.emplace_back(std::move(parsedResultObject));
|
|
664
755
|
});
|
|
665
756
|
|
|
666
757
|
// create jsi::Array result with correct filters
|
|
@@ -973,11 +1064,19 @@ folly::dynamic parser::Parser::parseStylesToShadowTreeStyles(jsi::Runtime& rt, c
|
|
|
973
1064
|
unistyleData->parsedStyle.value(),
|
|
974
1065
|
[this, &rt, &state, &convertedStyles](const std::string& propertyName, jsi::Value& propertyValue) {
|
|
975
1066
|
if (this->isColor(propertyName)) {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1067
|
+
if (propertyValue.isString()) {
|
|
1068
|
+
convertedStyles.setProperty(
|
|
1069
|
+
rt,
|
|
1070
|
+
propertyName.c_str(),
|
|
1071
|
+
jsi::Value(state.parseColor(propertyValue))
|
|
1072
|
+
);
|
|
1073
|
+
} else {
|
|
1074
|
+
convertedStyles.setProperty(
|
|
1075
|
+
rt,
|
|
1076
|
+
propertyName.c_str(),
|
|
1077
|
+
propertyValue
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
981
1080
|
|
|
982
1081
|
return;
|
|
983
1082
|
}
|
|
@@ -1021,10 +1120,60 @@ folly::dynamic parser::Parser::parseStylesToShadowTreeStyles(jsi::Runtime& rt, c
|
|
|
1021
1120
|
nestedValue.asObject(rt),
|
|
1022
1121
|
[this, &rt, &state, &obj](const std::string& nestedPropName, jsi::Value& nestedPropValue) {
|
|
1023
1122
|
if (this->isColor(nestedPropName)) {
|
|
1123
|
+
if (nestedPropValue.isString()) {
|
|
1124
|
+
obj.setProperty(
|
|
1125
|
+
rt,
|
|
1126
|
+
nestedPropName.c_str(),
|
|
1127
|
+
state.parseColor(nestedPropValue)
|
|
1128
|
+
);
|
|
1129
|
+
} else {
|
|
1130
|
+
obj.setProperty(
|
|
1131
|
+
rt,
|
|
1132
|
+
nestedPropName.c_str(),
|
|
1133
|
+
nestedPropValue
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
} else if (nestedPropValue.isObject()) {
|
|
1137
|
+
auto nestedObj = nestedPropValue.asObject(rt);
|
|
1138
|
+
|
|
1139
|
+
if (nestedObj.isArray(rt) || nestedObj.isFunction(rt)) {
|
|
1140
|
+
obj.setProperty(
|
|
1141
|
+
rt,
|
|
1142
|
+
nestedPropName.c_str(),
|
|
1143
|
+
nestedPropValue
|
|
1144
|
+
);
|
|
1145
|
+
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
jsi::Object parsedNestedObj(rt);
|
|
1150
|
+
|
|
1151
|
+
helpers::enumerateJSIObject(
|
|
1152
|
+
rt,
|
|
1153
|
+
nestedObj,
|
|
1154
|
+
[this, &rt, &state, &parsedNestedObj](const std::string& secondLevelPropName, jsi::Value& secondLevelPropValue) {
|
|
1155
|
+
if (this->isColor(secondLevelPropName) && secondLevelPropValue.isString()) {
|
|
1156
|
+
parsedNestedObj.setProperty(
|
|
1157
|
+
rt,
|
|
1158
|
+
secondLevelPropName.c_str(),
|
|
1159
|
+
state.parseColor(secondLevelPropValue)
|
|
1160
|
+
);
|
|
1161
|
+
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
parsedNestedObj.setProperty(
|
|
1166
|
+
rt,
|
|
1167
|
+
secondLevelPropName.c_str(),
|
|
1168
|
+
secondLevelPropValue
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
|
|
1024
1173
|
obj.setProperty(
|
|
1025
1174
|
rt,
|
|
1026
1175
|
nestedPropName.c_str(),
|
|
1027
|
-
|
|
1176
|
+
parsedNestedObj
|
|
1028
1177
|
);
|
|
1029
1178
|
} else {
|
|
1030
1179
|
obj.setProperty(
|
|
@@ -1042,11 +1191,15 @@ folly::dynamic parser::Parser::parseStylesToShadowTreeStyles(jsi::Runtime& rt, c
|
|
|
1042
1191
|
}
|
|
1043
1192
|
|
|
1044
1193
|
if (this->isColor(propertyName)) {
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1194
|
+
if (nestedValue.isString()) {
|
|
1195
|
+
parsedArray.setValueAtIndex(
|
|
1196
|
+
rt,
|
|
1197
|
+
i,
|
|
1198
|
+
jsi::Value(state.parseColor(nestedValue))
|
|
1199
|
+
);
|
|
1200
|
+
} else {
|
|
1201
|
+
parsedArray.setValueAtIndex(rt, i, nestedValue);
|
|
1202
|
+
}
|
|
1050
1203
|
} else {
|
|
1051
1204
|
parsedArray.setValueAtIndex(rt, i, nestedValue);
|
|
1052
1205
|
}
|
|
@@ -22,9 +22,13 @@ void shadow::ShadowTreeManager::updateShadowTree(jsi::Runtime& rt) {
|
|
|
22
22
|
for (const auto& [family, props] : updates) {
|
|
23
23
|
tagToProps.insert({family->getTag(), props});
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
auto* mutableFamily = const_cast<ShadowNodeFamily*>(family);
|
|
26
|
+
|
|
27
|
+
if (mutableFamily->nativeProps_DEPRECATED) {
|
|
28
|
+
mutableFamily->nativeProps_DEPRECATED->update(props);
|
|
29
|
+
} else {
|
|
30
|
+
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(props);
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
UIManagerBinding::getBinding(rt)->getUIManager().updateShadowTree(std::move(tagToProps));
|
|
@@ -40,8 +44,13 @@ void shadow::ShadowTreeManager::updateShadowTree(jsi::Runtime& rt) {
|
|
|
40
44
|
|
|
41
45
|
for (const auto& [family, props] : updates) {
|
|
42
46
|
// Merge props to fix glitches caused by REA updates
|
|
43
|
-
const_cast<ShadowNodeFamily*>(family)
|
|
44
|
-
|
|
47
|
+
auto* mutableFamily = const_cast<ShadowNodeFamily*>(family);
|
|
48
|
+
|
|
49
|
+
if (mutableFamily->nativeProps_DEPRECATED) {
|
|
50
|
+
mutableFamily->nativeProps_DEPRECATED->update(props);
|
|
51
|
+
} else {
|
|
52
|
+
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(props);
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JHybridNativePlatformSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "JHybridNativePlatformSpec.hpp"
|
|
@@ -56,6 +56,13 @@ namespace margelo::nitro::unistyles {
|
|
|
56
56
|
return method(_javaPart);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
bool JHybridNativePlatformSpec::equals(const std::shared_ptr<HybridObject>& other) {
|
|
60
|
+
if (auto otherCast = std::dynamic_pointer_cast<JHybridNativePlatformSpec>(other)) {
|
|
61
|
+
return _javaPart == otherCast->_javaPart;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
void JHybridNativePlatformSpec::dispose() noexcept {
|
|
60
67
|
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
61
68
|
method(_javaPart);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativePlatformSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -40,6 +40,7 @@ namespace margelo::nitro::unistyles {
|
|
|
40
40
|
|
|
41
41
|
public:
|
|
42
42
|
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override;
|
|
43
44
|
void dispose() noexcept override;
|
|
44
45
|
std::string toString() override;
|
|
45
46
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_UnistylesNativeMiniRuntime.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.unistyles
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.unistyles
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativePlatformSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.unistyles
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// UnistyleDependency.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.unistyles
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// UnistylesNativeMiniRuntime.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.unistyles
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# unistyles+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// unistyles+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// unistylesOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_UNISTYLES_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Unistyles+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Unistyles-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "Unistyles-Swift-Cxx-Bridge.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativePlatformSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativePlatformSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativePlatformSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -66,6 +66,12 @@ namespace margelo::nitro::unistyles {
|
|
|
66
66
|
inline size_t getExternalMemorySize() noexcept override {
|
|
67
67
|
return _swiftPart.getMemorySize();
|
|
68
68
|
}
|
|
69
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
70
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNativePlatformSpecSwift>(other)) {
|
|
71
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
69
75
|
void dispose() noexcept override {
|
|
70
76
|
_swiftPart.dispose();
|
|
71
77
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Dimensions.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void_UnistylesNativeMiniRuntime.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// HybridNativePlatformSpec.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/// See ``HybridNativePlatformSpec``
|
|
@@ -47,14 +46,14 @@ open class HybridNativePlatformSpec_base {
|
|
|
47
46
|
public init() { }
|
|
48
47
|
public func getCxxWrapper() -> HybridNativePlatformSpec_cxx {
|
|
49
48
|
#if DEBUG
|
|
50
|
-
guard self is HybridNativePlatformSpec else {
|
|
49
|
+
guard self is any HybridNativePlatformSpec else {
|
|
51
50
|
fatalError("`self` is not a `HybridNativePlatformSpec`! Did you accidentally inherit from `HybridNativePlatformSpec_base` instead of `HybridNativePlatformSpec`?")
|
|
52
51
|
}
|
|
53
52
|
#endif
|
|
54
53
|
if let cxxWrapper = self.cxxWrapper {
|
|
55
54
|
return cxxWrapper
|
|
56
55
|
} else {
|
|
57
|
-
let cxxWrapper = HybridNativePlatformSpec_cxx(self as! HybridNativePlatformSpec)
|
|
56
|
+
let cxxWrapper = HybridNativePlatformSpec_cxx(self as! any HybridNativePlatformSpec)
|
|
58
57
|
self.cxxWrapper = cxxWrapper
|
|
59
58
|
return cxxWrapper
|
|
60
59
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// HybridNativePlatformSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -96,6 +95,14 @@ open class HybridNativePlatformSpec_cxx {
|
|
|
96
95
|
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
96
|
}
|
|
98
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridNativePlatformSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
/**
|
|
100
107
|
* Call dispose() on the Swift class.
|
|
101
108
|
* This _may_ be called manually from JS.
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Insets.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// UnistylesNativeMiniRuntime.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativePlatformSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativePlatformSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridUnistylesNavigationBarSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridUnistylesNavigationBarSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridUnistylesRuntimeSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridUnistylesRuntimeSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridUnistylesShadowRegistrySpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridUnistylesShadowRegistrySpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridUnistylesStatusBarSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridUnistylesStatusBarSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridUnistylesStyleSheetSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridUnistylesStyleSheetSpec.hpp"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.23",
|
|
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.
|
|
149
|
+
"nitrogen": "0.33.8",
|
|
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.
|
|
153
|
+
"react-native-nitro-modules": "0.33.8",
|
|
154
154
|
"react-native-reanimated": "3.17.5",
|
|
155
155
|
"react-native-web": "0.20.0",
|
|
156
156
|
"react-test-renderer": "19.1.0",
|