[GH-ISSUE #109] PropTypes not set correctly #67

Closed
opened 2026-05-05 11:37:16 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @vikkio88 on GitHub (May 5, 2018).
Original GitHub issue: https://github.com/kusti8/proton-native/issues/109

Hi guys,
you did set proptypes on components as follows ComponentName.PropTypes but that is not the correct syntax, as it should be lower camel case ComponentName.PropTypes, so passing the wrong propTypes is not throwing any warning for me, nor is auto-completing on my IDE

Originally created by @vikkio88 on GitHub (May 5, 2018). Original GitHub issue: https://github.com/kusti8/proton-native/issues/109 Hi guys, you did set proptypes on components as follows `ComponentName.PropTypes` but that is not the correct syntax, as it should be lower camel case `ComponentName.PropTypes`, so passing the wrong `propTypes` is not throwing any warning for me, nor is auto-completing on my IDE
Author
Owner

@mischnic commented on GitHub (May 5, 2018):

proton-native checks them (not React):

d37dae1299/src/components/DesktopComponent.js (L54-L59)

And it does work:

<TextInput stretchy="false" />

->

Warning: Failed prop type: Invalid prop `stretchy` of type `string` supplied to `Entry`, expected `boolean`.

@kusti8 is there a specific reason you did it this way ?

<!-- gh-comment-id:386814225 --> @mischnic commented on GitHub (May 5, 2018): proton-native checks them (not React): https://github.com/kusti8/proton-native/blob/d37dae1299527cfc51905b8eccdc1d398ebe413f/src/components/DesktopComponent.js#L54-L59 And it does work: ```jsx <TextInput stretchy="false" /> ``` -> ``` Warning: Failed prop type: Invalid prop `stretchy` of type `string` supplied to `Entry`, expected `boolean`. ``` --- @kusti8 is there a specific reason you did it this way ?
Author
Owner

@vikkio88 commented on GitHub (May 5, 2018):

it would be nice to make adopt the same standard as react, dont you think?
https://reactjs.org/docs/typechecking-with-proptypes.html

<!-- gh-comment-id:386814315 --> @vikkio88 commented on GitHub (May 5, 2018): it would be nice to make adopt the same standard as react, dont you think? https://reactjs.org/docs/typechecking-with-proptypes.html
Author
Owner

@kusti8 commented on GitHub (May 6, 2018):

It's because when createElement makes a class, the React system does not know about it so it doesn't check props. React only checks props on React components, which the base components are not. I'll change the name to be more in line with React standards, but if you remove the checkProp line, then it doesn't work.

<!-- gh-comment-id:386895000 --> @kusti8 commented on GitHub (May 6, 2018): It's because when `createElement` makes a class, the React system does not know about it so it doesn't check props. React only checks props on React components, which the base components are not. I'll change the name to be more in line with React standards, but if you remove the checkProp line, then it doesn't work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/proton-native#67
No description provided.