react-native-unistyles 3.2.0 → 3.2.2
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.
|
@@ -68,27 +68,15 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
|
|
|
68
68
|
if (_suspendedFamilies.erase(shadowNodeFamily) > 0) {
|
|
69
69
|
auto* mutableFamily = const_cast<ShadowNodeFamily*>(shadowNodeFamily);
|
|
70
70
|
mutableFamily->nativeProps_DEPRECATED.reset();
|
|
71
|
+
// Clear old registry entries to prevent stale UnistyleData accumulation
|
|
72
|
+
this->_shadowRegistry.erase(shadowNodeFamily);
|
|
73
|
+
// Remove any stale traffic controller entry (e.g. from a theme change during suspension)
|
|
74
|
+
this->trafficController.removeShadowNode(shadowNodeFamily);
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
shadow::ShadowLeafUpdates updates;
|
|
74
|
-
auto parser = parser::Parser(nullptr);
|
|
75
|
-
|
|
76
77
|
std::for_each(unistylesData.begin(), unistylesData.end(), [this, shadowNodeFamily](std::shared_ptr<UnistyleData> unistyleData){
|
|
77
78
|
this->_shadowRegistry[shadowNodeFamily].emplace_back(unistyleData);
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
-
updates[shadowNodeFamily] = parser.parseStylesToShadowTreeStyles(rt, unistylesData);
|
|
81
|
-
|
|
82
|
-
auto* mutableFamily = const_cast<ShadowNodeFamily*>(shadowNodeFamily);
|
|
83
|
-
|
|
84
|
-
if (mutableFamily->nativeProps_DEPRECATED) {
|
|
85
|
-
mutableFamily->nativeProps_DEPRECATED->update(updates[shadowNodeFamily]);
|
|
86
|
-
} else {
|
|
87
|
-
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(updates[shadowNodeFamily]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
this->trafficController.setUpdates(updates);
|
|
91
|
-
this->trafficController.resumeUnistylesTraffic();
|
|
92
80
|
});
|
|
93
81
|
}
|
|
94
82
|
|
|
@@ -13,10 +13,13 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
|
13
13
|
auto& registry = core::UnistylesRegistry::get();
|
|
14
14
|
|
|
15
15
|
// this is special case for Animated, and prevents appending same unistyles to node
|
|
16
|
-
|
|
16
|
+
// skip for suspended families - they need a full re-link with fresh UnistyleData
|
|
17
|
+
if (!registry.isSuspended(&shadowNodeWrapper->getFamily())) {
|
|
18
|
+
registry.removeDuplicatedUnistyles(&shadowNodeWrapper->getFamily(), unistyleWrappers);
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
if (unistyleWrappers.empty()) {
|
|
21
|
+
return jsi::Value::undefined();
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
for (size_t i = 0; i < unistyleWrappers.size(); i++) {
|
|
@@ -20,14 +20,16 @@ void shadow::ShadowTreeManager::updateShadowTree(jsi::Runtime& rt) {
|
|
|
20
20
|
std::unordered_map<Tag, folly::dynamic> tagToProps;
|
|
21
21
|
|
|
22
22
|
for (const auto& [family, props] : updates) {
|
|
23
|
-
|
|
23
|
+
auto safeProps = props.isObject() ? props : folly::dynamic::object();
|
|
24
|
+
|
|
25
|
+
tagToProps.insert({family->getTag(), safeProps});
|
|
24
26
|
|
|
25
27
|
auto* mutableFamily = const_cast<ShadowNodeFamily*>(family);
|
|
26
28
|
|
|
27
|
-
if (mutableFamily->nativeProps_DEPRECATED) {
|
|
28
|
-
mutableFamily->nativeProps_DEPRECATED->update(
|
|
29
|
+
if (mutableFamily->nativeProps_DEPRECATED && mutableFamily->nativeProps_DEPRECATED->isObject()) {
|
|
30
|
+
mutableFamily->nativeProps_DEPRECATED->update(safeProps);
|
|
29
31
|
} else {
|
|
30
|
-
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(
|
|
32
|
+
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(safeProps);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -45,11 +47,12 @@ void shadow::ShadowTreeManager::updateShadowTree(jsi::Runtime& rt) {
|
|
|
45
47
|
for (const auto& [family, props] : updates) {
|
|
46
48
|
// Merge props to fix glitches caused by REA updates
|
|
47
49
|
auto* mutableFamily = const_cast<ShadowNodeFamily*>(family);
|
|
50
|
+
auto safeProps = props.isObject() ? props : folly::dynamic::object();
|
|
48
51
|
|
|
49
|
-
if (mutableFamily->nativeProps_DEPRECATED) {
|
|
50
|
-
mutableFamily->nativeProps_DEPRECATED->update(
|
|
52
|
+
if (mutableFamily->nativeProps_DEPRECATED && mutableFamily->nativeProps_DEPRECATED->isObject()) {
|
|
53
|
+
mutableFamily->nativeProps_DEPRECATED->update(safeProps);
|
|
51
54
|
} else {
|
|
52
|
-
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(
|
|
55
|
+
mutableFamily->nativeProps_DEPRECATED = std::make_unique<folly::dynamic>(safeProps);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unistyles",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "NODE_ENV=babel-test jest ./plugin ./src/__tests__",
|
|
@@ -145,13 +145,13 @@
|
|
|
145
145
|
"@babel/plugin-syntax-jsx": "7.28.6",
|
|
146
146
|
"@babel/runtime": "7.28.6",
|
|
147
147
|
"@react-native/babel-preset": "0.83.2",
|
|
148
|
-
"nitrogen": "0.35.
|
|
148
|
+
"nitrogen": "0.35.3",
|
|
149
149
|
"oxfmt": "0.35.0",
|
|
150
150
|
"oxlint": "1.50.0",
|
|
151
151
|
"react": "19.2.0",
|
|
152
152
|
"react-native": "0.83.2",
|
|
153
153
|
"react-native-builder-bob": "0.40.18",
|
|
154
|
-
"react-native-nitro-modules": "0.35.
|
|
154
|
+
"react-native-nitro-modules": "0.35.3",
|
|
155
155
|
"react-native-reanimated": "4.2.2",
|
|
156
156
|
"react-native-web": "0.21.2",
|
|
157
157
|
"typescript": "5.9.3"
|