Skip to content

Commit

Permalink
feat: accept any styles in shadow registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jpudysz committed Jan 13, 2025
1 parent ca416d4 commit 2e01a5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions example/App2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Text: React.FunctionComponent<TextProps> = ({ value, children, size }) =>
size
})

console.log(styles.text(value))

return (
<RNText style={styles.text(value)}>
{children}
Expand Down
8 changes: 6 additions & 2 deletions src/specs/ShadowRegistry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ const findShadowNodeForHandle = (handle: ViewHandle) => {

HybridShadowRegistry.add = (handle, styles) => {
// virtualized nodes can be null
if (!handle || !styles || !Array.isArray(styles)) {
if (!handle || !styles) {
return
}

const stylesArray = Array.isArray(styles)
? styles :
[styles]

// filter Reanimated styles and styles that are undefined
const filteredStyles = styles
const filteredStyles = stylesArray
.filter(style => !style?.initial?.updater)
.filter(style => style && Object.keys(style).length > 0)
.flat()
Expand Down

0 comments on commit 2e01a5a

Please sign in to comment.