From b8a9a7fd9e22df06955bb76179e9ac5c0926e57c Mon Sep 17 00:00:00 2001 From: Dan Forster <dan@simpleseed.com.au> Date: Mon, 13 Nov 2017 22:14:14 +0100 Subject: [PATCH] Add optional renderInput prop --- DateTime.js | 31 +++++++++++++++++++++---------- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/DateTime.js b/DateTime.js index 36ed8fa..d25e796 100644 --- a/DateTime.js +++ b/DateTime.js @@ -416,16 +416,27 @@ children = []; if ( this.props.input ) { - children = [ React.createElement( 'input', assign({ - key: 'i', - type: 'text', - className: 'form-control', - onClick: this.openCalendar, - onFocus: this.openCalendar, - onChange: this.onInputChange, - onKeyDown: this.onInputKey, - value: this.state.inputValue - }, this.props.inputProps ))]; + if ( this.props.renderInput ) { + children = children.concat( this.props.renderInput({ + onClick: this.openCalendar, + onFocus: this.openCalendar, + onChange: this.onInputChange, + onKeyDown: this.onInputKey, + value: this.state.inputValue, + openCalendar: this.openCalendar, + }) ); + } else { + children = [ DOM.input( assign({ + key: 'i', + type: 'text', + className: 'form-control', + onClick: this.openCalendar, + onFocus: this.openCalendar, + onChange: this.onInputChange, + onKeyDown: this.onInputKey, + value: this.state.inputValue + }, this.props.inputProps ))]; + } } else { className += ' rdtStatic'; } -- Gitblit v1.9.3