File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,29 @@ class DatePicker extends Component {
257257 this . props . onOpenModal ( ) ;
258258 }
259259 }
260+
261+ _renderIcon ( ) {
262+ const {
263+ showIcon,
264+ iconSource,
265+ iconComponent,
266+ customStyles
267+ } = this . props ;
268+
269+ if ( showIcon ) {
270+ if ( ! ! iconComponent ) {
271+ return iconComponent ;
272+ }
273+ return (
274+ < Image
275+ style = { [ Style . dateIcon , customStyles . dateIcon ] }
276+ source = { iconSource }
277+ />
278+ ) ;
279+ }
280+
281+ return null ;
282+ }
260283
261284 render ( ) {
262285 const {
@@ -290,10 +313,7 @@ class DatePicker extends Component {
290313 < View style = { dateInputStyle } >
291314 { this . getTitleElement ( ) }
292315 </ View >
293- { showIcon && < Image
294- style = { [ Style . dateIcon , customStyles . dateIcon ] }
295- source = { iconSource }
296- /> }
316+ { this . _renderIcon ( ) }
297317 { Platform . OS === 'ios' && < Modal
298318 transparent = { true }
299319 animationType = "none"
@@ -389,6 +409,7 @@ DatePicker.propTypes = {
389409 confirmBtnText : React . PropTypes . string ,
390410 cancelBtnText : React . PropTypes . string ,
391411 iconSource : React . PropTypes . oneOfType ( [ React . PropTypes . number , React . PropTypes . object ] ) ,
412+ iconComponent : React . PropTypes . element ,
392413 customStyles : React . PropTypes . object ,
393414 showIcon : React . PropTypes . bool ,
394415 disabled : React . PropTypes . bool ,
You can’t perform that action at this time.
0 commit comments