From 6c02759a3d8aebed03c852630d4c44b123f8c722 Mon Sep 17 00:00:00 2001 From: Bruno Date: Tue, 9 May 2017 15:28:47 -0300 Subject: [PATCH] Ability to pass icon component --- index.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 74341a6a11..f10d12accb 100644 --- a/index.js +++ b/index.js @@ -257,6 +257,29 @@ class DatePicker extends Component { this.props.onOpenModal(); } } + + _renderIcon() { + const { + showIcon, + iconSource, + iconComponent, + customStyles + } = this.props; + + if (showIcon) { + if (!!iconComponent) { + return iconComponent; + } + return ( + + ); + } + + return null; + } render() { const { @@ -290,10 +313,7 @@ class DatePicker extends Component { {this.getTitleElement()} - {showIcon && } + {this._renderIcon()} {Platform.OS === 'ios' &&