Skip to content

Commit

Permalink
fix: filter invalid styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Zivsteve committed Apr 26, 2021
1 parent 34634bf commit b620def
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Animated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,15 @@ export function createComponent<T extends NativeComponents>(WrappedComponent: T)
return;
}

const combinedStyles: Styles = Object.assign({}, style, this.getAnimatedStyle(style, e));
let combinedStyles: Styles = Object.assign({}, style, this.getAnimatedStyle(style, e));

// filter invalid styles
(Object.keys(combinedStyles) as (keyof Styles)[]).map((s) => {
if (!validStyles.includes(s)) {
delete combinedStyles[s];
}
});

return combinedStyles;
});

Expand Down Expand Up @@ -337,7 +345,7 @@ export function createComponent<T extends NativeComponents>(WrappedComponent: T)
{!!BeforeComponent && <BeforeComponent style={before}>{beforeContent}</BeforeComponent>}
<AnimatedComponent
ref={(r: NativeComponents) => {
forwardRef?.(r);
typeof forwardRef === 'function' && forwardRef(r);
this._ref = r;
}}
{...this.getPseudoProps()}
Expand Down

0 comments on commit b620def

Please sign in to comment.