I have been trying to figure out how to handle value changes in React Fabric TextFields. The problem is every time I set the value property, the component becomes read only. If is use the defaultValue property, everything works fine, apart from the fact I need this input to be controlled. I am using React Fabric inside a SharePoint Framework solution.
What I currently have is this:
...
this.state = {
title: ''
}
this.handleInputChange = this.handleInputChange.bind(this);
}
public handleInputChange(id, value) {
this.setState({
[id]: value
});
}
public render(): React.ReactElement<IQuoteAppProps> {
return (
<TextField
label='Title'
onChanged={(value) => this.handleInputChange('title', value)}
value={this.state.title}
required
/>
)
}
Does anyone know how to correctly set this up? I have included two screenshots as well.
Edit: I literally copied and pasted an example from the developer page mentioned below and it is still not working. The component on their website is working fine and can be edited. The only thing I now have in mind is whether React Fabric is not colliding with something inside SharePoint Framework.
Office UI Fabric TextField: https://developer.microsoft.com/en-us/fabric#/components/textfield
;] seems read only, F12 to check.– Lee Feb 08 '18 at 10:00