Skip to content

Commit 704fbd5

Browse files
Verify that the component passed to createAnimatedComponent is not
functional
1 parent 4ca6172 commit 704fbd5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Libraries/Animated/src/createAnimatedComponent.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ const AnimatedProps = require('./nodes/AnimatedProps');
1717
const React = require('React');
1818
const ViewStylePropTypes = require('ViewStylePropTypes');
1919

20+
const invariant = require('fbjs/lib/invariant');
21+
2022
function createAnimatedComponent(Component: any): any {
23+
invariant(
24+
Component.prototype.render,
25+
'`createAnimatedComponent` does not support stateless functional components, ' +
26+
'use a class component instead.',
27+
);
28+
2129
class AnimatedComponent extends React.Component<Object> {
2230
_component: any;
2331
_prevComponent: any;

0 commit comments

Comments
 (0)