javascript - react Native onChange event has name type value undefined -
i using nativebase react native app . trying trigger event when text changes on input fields
<input style={styles.vehiclemetercenter} placeholder={this.props.item['name']} value={this.state.item.name} onchange={this.onfieldchange}/> onfieldchange handler follows :-
onfieldchange(e) { console.log("master"); console.log(e); console.log("native event"); console.log(e.nativeevent); const {name,type,value} = e.nativeevent; console.log(name + " : " + type + " : " + value); //this.setstate({item:{name:val}}); } i confused output get, there no type, value or name. not sure how classify if handler triggered input field there no such information in these structs.
output of above code :
10:40:46 am: master 10:40:46 am: {"dispatchconfig":null,"_targetinst":null,"isdefaultprevented":null,"ispropagationstopped":null,"_dispatchlisteners":null,"_dispatchinstances":null,"type":null,"target":null,"eventphase":null,"bubbles":null,"cancelable":null,"defaultprevented":null,"istrusted":null,"nativeevent":null} 10:40:46 am: native event 10:40:46 am: {"target":622,"eventcount":1,"contentsize":{"height":24,"width":399470.46875},"text":"d"} 10:40:46 am: undefined : undefined : undefined what want achieve should able identify input field triggered event, , value inserted.
Comments
Post a Comment