Closed tolrodco closed 7 years ago
I think I was facing the similar issue for the data-ts: Form -> date type.. You may have to do in this way(I'm using redux-form):
import React from 'react';
export default class TSDate extends React.Component {
componentDidMount() {
const { input } = this.props;
/**
* The onchange event cannot be bind to the TS date input in this way: <input type='date' onChange={input.onChange} />
*
* Unlike other form component of TS, the events of the date input have to be registerd here.
* This might be a bug when integrating TS date input with React
*/
this.dateInput.name = input.name;
this.dateInput.onblur = input.onBlur;
this.dateInput.onchange = input.onChange; // in your case, it should be props.onUpdate
this.dateInput.ondragstart = input.onDragStart;
this.dateInput.ondrop = input.onDrop;
this.dateInput.onfocus = input.onFocus;
this.dateInput.value = input.value;
}
render() {
const { options } = this.props;
return (
<fieldset>
<label>
<span>{options.label}</span>
<input type='date'
ref={(input) => { this.dateInput = input; }} />
</label>
</fieldset>
)
}
}
@tolrodco and @RealDeanZhao The design goal for UI components is to integrate with frameworks such as React in a completely transparent way so that developers can handle forms (events and validation and so on) in a completely standard way, so this is indeed a grave bug :cry:
@tolrodco (and @RealDeanZhao): Can you confirm that the bug is fixed in version 7.0.0-rc.7
?
config.json
in the Apps-Serverruntime_version
to 7.0.0-rc.7
@wiredearp Tried, not working for the date input.
@RealDeanZhao and @tolrodco can you give it another try with 7.0.0-rc.8
?
React was waiting for an input
event for the DateInput
, but a change
event for the Select
and we were sending change
for both.
Yes, first thing I will do when I get into the office ...
I switched to tsui7 for Apps-Server using 7.0.0-rc.8 and can confirm that the actions for select onChange worked as expected.
Excellent! I'm closing the issue and just keep an eye out for the releases page or watch/star the repo to get notified by email. The final release should be out tomorrow.
@sampi , it works for 7.0.0-rc.8. Thank you.
bug
Tradeshift UI version affected
v6.1.1
Expected Behavior
User opens a aside panel, clicks on
select
and chooses an option from the aside list. After selection, data is properly passed back to the select tag and made available to react to update the value.Actual Behavior
Form and asides appear to function properly, however data is not available to the react app to update the value, instead the props.fields are not updated and are reset to their original state.
Steps to reproduce
Create a normal
data-ts: Form
tag with aselect
that contains anonClick:
update function:Example
Aside state:
The field we are trying to update in the example is the
status
field in the asides array. Using the simplified example above you would expect the value to be updated using theprops.onUpdate()
function.To validate the issue I changed the form to a simple div element and removed the
data-ts
attribute. Once completed, I attempted to set the value to an alternate option and clicked save; the value was indeed passed back to react and set properly for the selected row object.