Skip to content

Commit 65e5d6d

Browse files
committed
feat: updating working
1 parent e46feb4 commit 65e5d6d

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

cpp/ShadowTreeUpdateManager.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,18 @@ namespace margelo {
129129
obs = Observable<UpdatesMap>::create(UpdatesMap{});
130130
}
131131

132-
// Convert each style entry into a dynamic update object
133-
folly::dynamic payload = folly::dynamic::array();
134-
payload.reserve(styleEntries.size());
132+
// Convert each style entry into a dynamic update object (merged into a single object per tag)
133+
folly::dynamic payload = folly::dynamic::object();
135134
for (const auto &p: styleEntries) {
136135
if (!p) {
137-
payload.push_back(folly::dynamic::object());
138136
continue;
139137
}
140-
payload.push_back(styleEntryToUpdate(*link.runtime, *p));
138+
auto obj = styleEntryToUpdate(*link.runtime, *p);
139+
if (obj.isObject()) {
140+
for (auto &kv: obj.items()) {
141+
payload[kv.first] = std::move(kv.second);
142+
}
143+
}
141144
}
142145

143146
UpdatesMap cur = obs->get();

example/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { View, StyleSheet, processColor } from 'react-native';
1+
import { View, StyleSheet } from 'react-native';
22
import { multiply, StyleRegistry } from 'react-native-css-nitro';
33
import { Text } from 'react-native-css-nitro/components/Text';
44

5-
// StyleRegistry.set('text-red-500', { s: [], d: [{ color: 4278190335 }] });
65
StyleRegistry.set('text-red-500', { s: [], d: [{ color: 'red' }] });
76

8-
console.log({ red: processColor('red') });
9-
107
export default function App() {
118
return (
129
<View style={styles.container}>
1310
<Text
1411
className="text-red-500"
1512
onPress={() => {
1613
console.log('Pressed!');
17-
StyleRegistry.set('text-red-500', { s: [], d: [{ fontSize: 30 }] });
14+
StyleRegistry.set('text-red-500', {
15+
s: [],
16+
d: [{ color: 'blue', fontSize: 40 }],
17+
});
1818
}}
1919
>
2020
Multiply: {multiply(3, 7)}

0 commit comments

Comments
 (0)