createAnimatedComponent should support stateless functional components [React Hooks]
See original GitHub issueFor Discussion
I am starting to play with hooks in react native following guide posted by hramos https://github.com/facebook/react-native/issues/21967#issuecomment-434113687
Off the bat I got an error
createAnimatedComponent
does not support stateless functional components; use a class instead.
This was as a result of me converting my simplest components (that don’t rely on anything related to hooks) to functions and I assume will be an issue further down the road since vision of react for the future is to use less classes and more function components.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
reactjs - Pass functional component to Animated ...
Coming from an app that uses react hooks, basically all of my component are functional. Is there a way / helper that can...
Read more >useAnimatedProps | React Native Reanimated
useAnimatedProps. This hook is a counterpart of useAnimatedStyle hook, but works for a non-style view properties. It allows for defining a set of...
Read more >Move to functional components from the class components.
We will be focusing on two hooks here and how to use them to convert class component to a functional component. useState. It...
Read more >Use Functional component as Animated Component - FyndX
In React Native at this moment Animated.createAnimatedComponent can be used only with class based components but not with functional components.
Read more >Using the State Hook - React
or this: function Example(props) { // You can use Hooks here! return <div />; }. You might have previously known these as “stateless...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think this requires a new issue, you can comment on the original issue itself.
I just tried this w/ a forwardRef and received the same error, and looking at the code of how forwardRef works, it is unclear it would pass this check. Does the forwardRef trick still work for people running on 16.8?