Reputation: 373
I am trying to pass style to children, my code is :
render() {
const RotateData = this.RotateValueHolder.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg']
});
Object.assign(this.props.children.props.style,{'transform': [{'rotate': RotateData}] });
return (
<View style={{flex:1}}>
{this.props.children}
</View>
);
}
I getting this error :
Invariant Violation: Transform with key of "rotate" must be a string:
{"rotate":"0deg"}
Upvotes: 1
Views: 667
Reputation: 1286
Rotate can be only used by the animated component, so you need to apply the style to Animated.View or any Animated element. so try to use it with animated component.
Upvotes: 1