FormField doesn't work with CustomComponent after updating to v2.11.3
See original GitHub issueExpected Behavior
FormField should work with CustomComponent
Actual Behavior
After updating to v2.11.3, after typing one character in a custom text input, I can no longer type any other character. After spending some time debugging, I noticed that by adding the value
property to the Form
component fixes it.
This, however, introduces a warning.
Warning: Cannot update a component (`Form`) while rendering a different component (`TextInput`). To locate the bad setState() call inside `TextInput`, follow the stack trace as described in https://fb.me/setstate-in-render
URL, screen shot, or Codepen exhibiting the issue
You can try it out here https://codesandbox.io/s/grommet-sandbox-vso4c. Try removing the value from From and notices that you can no longer type in the CustomComponent
Steps to Reproduce
- Add a CustomComponent to a FormField
- Make sure
value
property is not set for the Form - Try to type in the CustomComponent, this wouldn’t work.
- Add
value
to the Form component and you will be able to type - Open your console, reload and type again
- You will see the warning message written above
Your Environment
- Grommet version: 2.11.3
- Browser Name and version: Chrome Version 80.0.3987.149 (Official Build) (64-bit)
- Operating System and version (desktop or mobile): macOS Catalina version 10.15.3 (Desktop)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Grommet - custom component in FormField - Stack Overflow
Run the following and check out the console logs to see how the value is being updated as you type in the custom...
Read more >joomla 3.x - Custom form field not working on server
I want to display the field as selectbox on server as well. joomla-3.x · custom-component · custom-field · Share.
Read more >Turn Anything Into A Form Field With React Hook Form ...
Here we see the two props required to make our field component work with the Controller: value - It should show the current...
Read more >Angular Custom Form Controls - Complete Guide
In this guide, we are going to learn exactly how to take an existing custom form control component and make it fully compatible...
Read more >ASP.NET Core Blazor forms and input components
and HandleValidSubmit is not called. If the <input> form field contains more than ten characters when the Submit button is selected, ...
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 FreeTop 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
Top GitHub Comments
The warning in the above sandbox is due to:
const [name, setName] = useState();
not specifying an initial value. If I change that line to beconst [name, setName] = useState('');
instead, the warning is removed. This is due toname
now having an initial value of ‘’ instead of undefined.Any update on this issue?