storybookjs/babel-plugin-react-docgen

IsStatelessComponent returning false on valid component

luujam1 opened this issue · 4 comments

I have this component which has the react syntax transpiled:

import React from 'react';
import PropTypes from 'prop-types';

const Kitten = ({ isWide, isLong }) => React.createElement('img', { width: isWide ? '500' : '200', height: isLong ? '500' : '200', src: 'http://placekitten.com.s3.amazonaws.com/homepage-samples/200/287.jpg' });

Kitten.propTypes = {
  /** Whether the cat is wide */
  isWide: PropTypes.bool,
  /** Whether the cat is long */
  isLong: PropTypes.bool
};

Kitten.defaultProps = {
  isWide: false,
  isLong: false
};

export default Kitten;

This plugin doesn't call react-docgen since it doesn't consider it as a react component. However when I parse it directly using react-docgen I get the docgen info. Is it possible to be able to configure the babel plugin to accept this component format? Thanks

Would you mind submitting a PR for this? @luujam1

@danielduan I have create a PR. Please see #31

PR merged, closing issue. Thanks for the help @luujam1!

@luujam1 fyi, new version v1.6.0 is published