File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff line change 1- import { View , StyleSheet , processColor } from 'react-native' ;
1+ import { View , StyleSheet } from 'react-native' ;
22import { multiply , StyleRegistry } from 'react-native-css-nitro' ;
33import { Text } from 'react-native-css-nitro/components/Text' ;
44
5- // StyleRegistry.set('text-red-500', { s: [], d: [{ color: 4278190335 }] });
65StyleRegistry . set ( 'text-red-500' , { s : [ ] , d : [ { color : 'red' } ] } ) ;
76
8- console . log ( { red : processColor ( 'red' ) } ) ;
9-
107export 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 ) }
You can’t perform that action at this time.
0 commit comments