Closed KCraw closed 7 years ago
Would you like for this to be a parameter in the callback? For example change: https://github.com/dubert/react-kronos/blob/master/src/index.js#L342
to:
if (this.props.onSelect) this.props.onSelect(datetime, willBeVisible, didValidate)
(and obviously define the didValidate variable)
Yeah, that would be great. That way we can follow similar logic to the default of not closing the input if it was somehow invalid. Thanks!
On Thu, Sep 15, 2016 at 12:35 PM, Luke Dubert notifications@github.com wrote:
Would you like for this to be a parameter in the callback? For example change: https://github.com/dubert/react-kronos/blob/master/src/ index.js#L342
to:
if (this.props.onSelect) this.props.onSelect(datetime, willBeVisible, didValidate)
(and obviously define the didValidate variable)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dubert/react-kronos/issues/44#issuecomment-247396932, or mute the thread https://github.com/notifications/unsubscribe-auth/AHs6LVuYe6fQzwDGYqLUQ4XjzbqX3Mltks5qqYHpgaJpZM4J5Lk3 .
Just released 1.6.0!
onSelect
will now include (datetime, visible, shouldClose)
. shouldClose
will inform you whether it validated.
When controlling visibility, there is currently no way to know whether validation succeeded or failed when
props.onSelect
is called.The internal
onSelect
uses toggles state.visible; however, if you have enabledcontrolVisibility
, this will be out of sync with the actual visibility.The
props.onSelect
callback should set the appropriate visibility, but it would be nice to know whether the validation succeeded or not.