File tree Expand file tree Collapse file tree 3 files changed +15
-27
lines changed Expand file tree Collapse file tree 3 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ export default class Datetime extends React.Component {
7373 strictParsing : true ,
7474 closeOnSelect : false ,
7575 closeOnTab : true ,
76- closeOnClickOutside : true
76+ closeOnClickOutside : true ,
77+ renderView : ( _ , renderFunc ) => renderFunc ( ) ,
7778 }
7879
7980 // Make moment accessible through the Datetime class
@@ -123,10 +124,7 @@ export default class Datetime extends React.Component {
123124 }
124125
125126 renderView ( ) {
126- if ( this . props . renderView ) {
127- return this . props . renderView ( this . state . currentView , this . _renderCalendar ) ;
128- }
129- return this . _renderCalendar ( ) ;
127+ return this . props . renderView ( this . state . currentView , this . _renderCalendar ) ;
130128 }
131129
132130 _renderCalendar = ( ) => {
@@ -597,7 +595,6 @@ export default class Datetime extends React.Component {
597595 // Focus event should open the calendar, but there is some case where
598596 // the input is already focused and the picker is closed, so clicking the input
599597 // should open it again see https://github.com/arqex/react-datetime/issues/717
600- console . log ( 'CLICKING 2!' ) ;
601598 if ( ! this . callHandler ( this . props . inputProps . onClick , e ) ) return ;
602599 this . _openCalendar ( ) ;
603600 }
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import ViewNavigation from '../parts/ViewNavigation';
33
44export default class DaysView extends React . Component {
55 static defaultProps = {
6- isValidDate : ( ) => true
6+ isValidDate : ( ) => true ,
7+ renderDay : ( props , date ) => < td { ...props } > { date . date ( ) } </ td > ,
78 }
89
910 render ( ) {
@@ -110,14 +111,8 @@ export default class DaysView extends React.Component {
110111
111112 dayProps . className = className ;
112113
113- if ( this . props . renderDay ) {
114- return this . props . renderDay (
115- dayProps , date . clone ( ) , selectedDate && selectedDate . clone ( )
116- ) ;
117- }
118-
119- return (
120- < td { ...dayProps } > { date . date ( ) } </ td >
114+ return this . props . renderDay (
115+ dayProps , date . clone ( ) , selectedDate && selectedDate . clone ( )
121116 ) ;
122117 }
123118
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import React from 'react';
22import ViewNavigation from '../parts/ViewNavigation' ;
33
44export default class YearsView extends React . Component {
5+ static defaultProps = {
6+ renderYear : ( props , year ) => < td { ...props } > { year } </ td > ,
7+ } ;
8+
59 render ( ) {
610 return (
711 < div className = "rdtYears" >
@@ -66,18 +70,10 @@ export default class YearsView extends React.Component {
6670
6771 let props = { key : year , className, 'data-value' : year , onClick } ;
6872
69- if ( this . props . renderYear ) {
70- return this . props . renderYear (
71- props ,
72- year ,
73- this . props . selectedDate && this . props . selectedDate . clone ( )
74- ) ;
75- }
76-
77- return (
78- < td { ...props } >
79- { year }
80- </ td >
73+ return this . props . renderYear (
74+ props ,
75+ year ,
76+ this . props . selectedDate && this . props . selectedDate . clone ( )
8177 ) ;
8278 }
8379
You can’t perform that action at this time.
0 commit comments