question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onChange event for TextField component is wrong type

See original GitHub issue

This 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). image

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: image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
reesscotcommented, Mar 17, 2022

This will be fixed in our next major release.

2reactions
zchenweicommented, Feb 18, 2022

@reesscot is working on splitting out TextArea and TextField. So this wrong type thing will be fixed by then

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found