<Input> disable in <TextField> not working
See original GitHub issueI get the following error when i toggle disable <TextField> input:
Uncaught Error: MDCReactTextField: The input did not render properly
at Object.getNativeInput (VM3816 index.js:300)
at MDCTextFieldFoundation.getNativeInput_ (VM3816 index.js:559)
at MDCTextFieldFoundation.setDisabled (VM3816 index.js:531)
at Input.226.Input.componentDidUpdate (VM3816 index.js:775)
at commitLifeCycles (VM1337 react-dom.development.js:17303)
at commitAllLifeCycles (VM1337 react-dom.development.js:18690)
at HTMLUnknownElement.callCallback (VM1337 react-dom.development.js:149)
at Object.invokeGuardedCallbackDev (VM1337 react-dom.development.js:199)
at invokeGuardedCallback (VM1337 react-dom.development.js:256)
at commitRoot (VM1337 react-dom.development.js:18902)
at eval (VM1337 react-dom.development.js:20372)
at Object.unstable_runWithPriority (VM1344 scheduler.development.js:255)
at completeRoot (VM1337 react-dom.development.js:20371)
at performWorkOnRoot (VM1337 react-dom.development.js:20300)
at performWork (VM1337 react-dom.development.js:20208)
at performSyncWork (VM1337 react-dom.development.js:20182)
at interactiveUpdates$1 (VM1337 react-dom.development.js:20449)
at interactiveUpdates (VM1337 react-dom.development.js:2170)
at dispatchInteractiveEvent (VM1337 react-dom.development.js:4882)
import React, { useState } from "react";
import { render } from "react-dom";
import TextField, { Input } from "@material/react-text-field";
import Button from "@material/react-button";
import "./styles.css";
const App = () => {
const [toggle, setToggle] = useState(false);
const onToggle = () => {
setToggle(!toggle);
};
return (
<div className="App">
<TextField label="test">
<Input disabled={toggle} value="1234" />
</TextField>
<Button outlined onClick={onToggle}>
toggle disable
</Button>
</div>
);
};
const rootElement = document.getElementById("root");
render(<App />, rootElement);
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to disable an input type=text? - javascript - Stack Overflow
Working example: Show activity on this post. You can get the DOM element and set disabled attribute to true/false. If you use vue...
Read more >HTML input disabled Attribute - W3Schools
The disabled attribute is a boolean attribute. When present, it specifies that the <input> element should be disabled. A disabled input element is...
Read more >Disable TextFields Then Enable Them - Apple Developer
This is the code I have its similar to the example in my textFieldShouldReturn function. I don't have the textFields empty as default....
Read more >Disable and enable an input text box with JavaScript/jQuery
This post will discuss how to disable and enable an input text box in JavaScript and jQuery. When the element is disabled, it...
Read more >How to Set the Disabled State in React TextBox component
Disable the TextBox by adding the e-disabled to the input parent element and set disabled attribute to the input element. ... Is this...
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
Maybe we need to consider observer or singleton pattern for preventing like this situation.
Closing with #848