MCPcopy Create free account
hub / github.com/Lobos/react-ui / handleChange

Method handleChange

src/higherOrders/FormItem.js:124–143  ·  view source on GitHub ↗
(value, props)

Source from the content-addressed store, hash-verified

122 }
123
124 handleChange (value, props) {
125 if (!props || typeof props !== 'object' || props.nativeEvent) {
126 props = this.props;
127 }
128 if (typeof value === 'object' && value.nativeEvent) {
129 value = value.target.value;
130 }
131 let { itemChange, onChange } = props;
132 let result = value instanceof Error ? value : this.validate(value, props);
133 this.setState({ value }, () => {
134 itemChange = itemChange || this.props.itemChange;
135 onChange = onChange || this.props.onChange;
136 if (itemChange) {
137 itemChange(this.id, value, result);
138 }
139 if (onChange) {
140 onChange(...arguments);
141 }
142 });
143 }
144
145 render () {
146 let { className, onChange, value, style, ...props } = this.props;

Callers 3

setValueMethod · 0.95

Calls 2

validateMethod · 0.95
onChangeFunction · 0.85

Tested by

no test coverage detected