Comments (9)
That warning is in how you're using TextField
, not the generated proptypes.
from babel-plugin-flow-react-proptypes.
hmmm, here's a gist (I'm working on an integration with react-formal): https://gist.github.com/rosskevin/e166b1a174f961ac61a091930dfcefa7
Do you spot the misuse?
from babel-plugin-flow-react-proptypes.
maybe related: reduxjs/react-redux#6
es7 use?
from babel-plugin-flow-react-proptypes.
You're not specifying an onChange or onBlur here: https://gist.github.com/rosskevin/e166b1a174f961ac61a091930dfcefa7#file-signin-js-L71
from babel-plugin-flow-react-proptypes.
That's a react-formal Field
. I register my TexField
as a handler for password
, and Field
passes those props to TexField
.
Effectively:
<Field>
<TextField {...this.props} onChange={x} onBlur={x} />
</Field>
from babel-plugin-flow-react-proptypes.
Right. But you never pass those props to Form.Field
. So it never passes them to TextField
.
There's nothing in here: https://github.com/jquense/react-formal/blob/master/src/Field.jsx that's going to pass an onBlur
or onChange
handler to your TextField
without it having been passed to the Form.Field
.
from babel-plugin-flow-react-proptypes.
Maybe I'm not describing it well. I don't want to/intend to pass these handlers...ever. react-formal Form.Field
dynamically connects the Form
's handlers (onChange && onBlur
) and passes them and other information to my TextField
. My client code (Signin
) needs no knowledge of these handlers.
I know with certainty that TextField
is receiving these handlers and they are not null.
Here (my TextField
is Widget
) is instantiated by Form.Field
: https://github.com/jquense/react-formal/blob/master/src/Field.jsx#L426
I don't spot onBlur
specified as a required propType in react-formal Field
. Is this the source of the Warning? That we have a broken chain of requires? Meaning I am receiving them, but the propTypes don't guarantee it based on them being missing in react-formal Field
?
from babel-plugin-flow-react-proptypes.
Ah, didn't realize it was context aware to the Form
. But even so, your Form
doesn't have an onBlur
, so I don't know what your password field would be receiving for that prop.
And no, propTypes are runtime checks. There's nothing static about them/no guarantees of any kind, so if you're getting a warning from them (as you are here), the warning is indicating a specific example of a runtime type check (in this case, your onBlur
prop not being provided) failing.
from babel-plugin-flow-react-proptypes.
Ok, thanks much for the look, helps my understanding. I'll figure out where/when/why it is missing, certainly if the check is implemented, it's a good warning!
from babel-plugin-flow-react-proptypes.
Related Issues (20)
- PropTypes are not added to class components with intersected type parameters HOT 2
- Import type - implementation guidelines? HOT 4
- Not working when module.name_mapper is used HOT 1
- transforming recompose context props. HOT 1
- Types imported with `import *` (import star) are treated as values, causing runtime error HOT 4
- Add support for $ReadOnlyArray HOT 2
- Error when union types HOT 1
- Perform escape analysis on imported types HOT 3
- Fails to check "Objects as maps"
- Identifier 'PropTypes' has already been declared HOT 2
- Example form README is not transpiled correctly HOT 2
- plugin errors when parsing "empty" types HOT 2
- Undefined variable in output when input file contains two classes using same prop types HOT 4
- Using built-in generics in a generic type fails
- Add support for recursive data types
- aria-{name} and data-{name} props do not work HOT 1
- Issue when using with rollup imports HOT 2
- Support `React.ElementConfig`
- support webpack5
- Suppression only works for the very first directive (which might not be user-controllable)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-flow-react-proptypes.