If you try to pass functional (non react class) component to Animated.createAnimatedComponent
it throws an error that says
Stateless functional components are invalid as children of createAnimatedComponent
Coming from an app that uses react hooks, basically all of my component are functional.
Is there a way / helper that can allow to pass these to createAnimatedComponent
without wrapping them in Animated.View
or even just View
?
Here is an example of component that I want to make animatable
function MyComponent({ someProp }) {
const [counter, setCounter] = useState(0);
return (
<View>
<Text>{counter}</Text>
</View>
);
}
useState(0)
? – InternodeMyComponent
is a React component... – Dunderhead