複数の入力が1つのソースにしか影響しないカスタム入力を作成するにはどうすればよいですか? 私は時間を秒として保存する "時間:分:秒"というカスタム時間入力があります。複数の入力を同じソースをターゲットにする方法は?
私がこれまで持っているもの:
// calling the custom input with the expected source
<TimeInput source="time_A" />
// in the TimeInput component
<span>
<Field component={NumberInput} name="hh" value={this.state.hh} onChange={this.handleChange} />
<Field component={NumberInput} name="mm" value={this.state.mm} onChange={this.handleChange} />
<Field component={NumberInput} name="ss" value={this.state.ss} onChange={this.handleChange} />
</span>
handleChange方法は、フィールドの名前に応じて入力された値を解析し、(この場合は:「time_A」)のオリジナルソースを更新する必要があります。その更新は、私が本当にやり方を理解できないものです。
解決策はthis.props.input.onChangeを使用していると思いますが、this.props.inputが定義されていないため、何か間違っている必要があります。
どのような考えですか?
コンポーネントの完全なコードを投稿できますか? – Gildas