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 {
257
257
this . props . onOpenModal ( ) ;
258
258
}
259
259
}
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
+ }
260
283
261
284
render ( ) {
262
285
const {
@@ -290,10 +313,7 @@ class DatePicker extends Component {
290
313
< View style = { dateInputStyle } >
291
314
{ this . getTitleElement ( ) }
292
315
</ View >
293
- { showIcon && < Image
294
- style = { [ Style . dateIcon , customStyles . dateIcon ] }
295
- source = { iconSource }
296
- /> }
316
+ { this . _renderIcon ( ) }
297
317
{ Platform . OS === 'ios' && < Modal
298
318
transparent = { true }
299
319
animationType = "none"
@@ -389,6 +409,7 @@ DatePicker.propTypes = {
389
409
confirmBtnText : React . PropTypes . string ,
390
410
cancelBtnText : React . PropTypes . string ,
391
411
iconSource : React . PropTypes . oneOfType ( [ React . PropTypes . number , React . PropTypes . object ] ) ,
412
+ iconComponent : React . PropTypes . element ,
392
413
customStyles : React . PropTypes . object ,
393
414
showIcon : React . PropTypes . bool ,
394
415
disabled : React . PropTypes . bool ,
You can’t perform that action at this time.
0 commit comments