Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when used with createReactClass #189

Open
carystanley opened this issue Oct 9, 2019 · 1 comment
Open

Issue when used with createReactClass #189

carystanley opened this issue Oct 9, 2019 · 1 comment

Comments

@carystanley
Copy link

I found that the plugin had issues when used with createReactClass

example:

var SelectBox = createReactClass({

    propTypes: {	
        value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),	
        selectId: PropTypes.string.isRequired,	
        fullwidth: PropTypes.bool.isRequired	
    },
...
});

Seems to somewhat work on createReactClass components as long as the the propTypes declaration is not two deep like a PropTypes.string.isRequired or as long as functions are not used like: PropTypes.oneOfType(), PropTypes.arrayOf(), or PropTypes.shape(). Almost like PropTypes is being replaced with an empty object.

@carystanley
Copy link
Author

Workaround for users experience this is to move propTypes declaration outside of createReactClass:

example:

var SelectBox = createReactClass({
...
});

SelectBox.propTypes = {	
    value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),	
    selectId: PropTypes.string.isRequired,	
    fullwidth: PropTypes.bool.isRequired	
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant