Skip to content

defaultProps are ignored #38

@sompylasar

Description

@sompylasar

Default UI state for PropTypes.bool props always render to true (switched on) regardless of the defaultProps of false.

Looks like this line is relevant:

const defaultProps = this._properties[prop] || values;

const defaultProps = this._properties[prop] || values;

this._properties[prop] is either false, the value from the component's defaultProps, or undefined because defaultProps aren't accounted for here (if I understand this piece correctly).

So it falls back to the default value which is true for PropTypes.bool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions