( node: DOMElement, textStyles: TextStyles, )
| 274 | } |
| 275 | |
| 276 | export const setTextStyles = ( |
| 277 | node: DOMElement, |
| 278 | textStyles: TextStyles, |
| 279 | ): void => { |
| 280 | // Same dirty-check guard as setStyle: React (and buildTextStyles in Text.tsx) |
| 281 | // allocate a new textStyles object on every render even when values are |
| 282 | // unchanged, so compare by value to avoid markDirty -> yoga re-measurement |
| 283 | // on every Text re-render. |
| 284 | if (shallowEqual(node.textStyles, textStyles)) { |
| 285 | return |
| 286 | } |
| 287 | node.textStyles = textStyles |
| 288 | markDirty(node) |
| 289 | } |
| 290 | |
| 291 | function stylesEqual(a: Styles, b: Styles): boolean { |
| 292 | return shallowEqual(a, b) |
no test coverage detected