Skip to content

Commit

Permalink
Verify that the component passed to createAnimatedComponent is not
Browse files Browse the repository at this point in the history
functional
  • Loading branch information
janicduplessis committed Sep 9, 2017
1 parent 4ca6172 commit 704fbd5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Libraries/Animated/src/createAnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ const AnimatedProps = require('./nodes/AnimatedProps');
const React = require('React');
const ViewStylePropTypes = require('ViewStylePropTypes');

const invariant = require('fbjs/lib/invariant');

function createAnimatedComponent(Component: any): any {
invariant(
Component.prototype.render,
'`createAnimatedComponent` does not support stateless functional components, ' +
'use a class component instead.',
);

class AnimatedComponent extends React.Component<Object> {
_component: any;
_prevComponent: any;
Expand Down

0 comments on commit 704fbd5

Please sign in to comment.