onChange event for TextField component is wrong type
See original GitHub issueThis issue is related to the amplify-ui@next
for React.
The event passed as argument to the function should be something like ChangeEvent<HTMLInputElement>
, like it is in <PasswordField>
, but instead has any
(see screenshot below).
This means that when trying to access things like the value of the target (e.target.value
) TS won’t compile unless I explicitly set the type in the signature of the event handler like:
onChange={(e: ChangeEvent<HTMLInputElement>) => { /*...*/ }}
Expected:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
can't type in text field after adding onChange react typescript
I'm trying to add a onChange event to my input field component but when I the onChange evenet handler I can no longer...
Read more >onChange not working with custom React TextField component
Hi,. My apologies if this is the wrong place to post this - I'm currently trying to do an onChange event with a...
Read more >HTMLElement: change event - Web APIs | MDN
When the element loses focus after its value was changed: for elements where the user's interaction is typing rather than selection, such as...
Read more >HTML onchange Event Attribute - W3Schools
The onchange attribute fires the moment when the value of the element is ... Supported HTML tags: <input type="checkbox">, <input type="file">, <input ......
Read more >useTextField – React Aria - React Spectrum Libraries
Built with a native <input> or <textarea> element; Visual and ARIA labeling support; Change, clipboard, composition, selection, and input event support ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This will be fixed in our next major release.
@reesscot is working on splitting out
TextArea
andTextField
. So this wrong type thing will be fixed by then