Javascript airbnb react-dates showClearDate throwing










1















I am trying to get the clear date button appearing on the SingleDatePicker. Looking at the documentation all I have to do is add the showClearDate attribute to the SingleDatePicker. This is how I've implemented it:



<SingleDatePicker 
date=null
isOutsideRange= (date) => return false
id=detail.name
showClearDate=true
focused=focused
numberOfMonths= 1
onDateChange= (date) => handleDateChange( momentToISO(date) )
onFocusChange=( focused ) =>
handleFocusChange(focused)


/>


Evertying works fine if I remove the showClearDate attribute (without showing the button of course) but when I add this attribute in I get an exception "cannot read property onClearDateMouseEnter of undefined"



The following is taken from the react-dates SingleDatePickerInput.jsx showing where the error is occurring.



 showClearDate && (
<button
...css(
styles.SingleDatePickerInput_clearDate,
small && styles.SingleDatePickerInput_clearDate__small,
!customCloseIcon && styles.SingleDatePickerInput_clearDate__default,
!displayValue && styles.SingleDatePickerInput_clearDate__hide,
)
type="button"
aria-label=phrases.clearDate
disabled=disabled
onMouseEnter=this.onClearDateMouseEnter // here
onMouseLeave=this.onClearDateMouseLeave // i imagine here too
onClick=onClearDate
>
closeIcon
</button>
)


There is no reference in the documentation to having to supply the function onClearDateMouseEnter function or any other reference to it in code.



What am I missing here?










share|improve this question


























    1















    I am trying to get the clear date button appearing on the SingleDatePicker. Looking at the documentation all I have to do is add the showClearDate attribute to the SingleDatePicker. This is how I've implemented it:



    <SingleDatePicker 
    date=null
    isOutsideRange= (date) => return false
    id=detail.name
    showClearDate=true
    focused=focused
    numberOfMonths= 1
    onDateChange= (date) => handleDateChange( momentToISO(date) )
    onFocusChange=( focused ) =>
    handleFocusChange(focused)


    />


    Evertying works fine if I remove the showClearDate attribute (without showing the button of course) but when I add this attribute in I get an exception "cannot read property onClearDateMouseEnter of undefined"



    The following is taken from the react-dates SingleDatePickerInput.jsx showing where the error is occurring.



     showClearDate && (
    <button
    ...css(
    styles.SingleDatePickerInput_clearDate,
    small && styles.SingleDatePickerInput_clearDate__small,
    !customCloseIcon && styles.SingleDatePickerInput_clearDate__default,
    !displayValue && styles.SingleDatePickerInput_clearDate__hide,
    )
    type="button"
    aria-label=phrases.clearDate
    disabled=disabled
    onMouseEnter=this.onClearDateMouseEnter // here
    onMouseLeave=this.onClearDateMouseLeave // i imagine here too
    onClick=onClearDate
    >
    closeIcon
    </button>
    )


    There is no reference in the documentation to having to supply the function onClearDateMouseEnter function or any other reference to it in code.



    What am I missing here?










    share|improve this question
























      1












      1








      1








      I am trying to get the clear date button appearing on the SingleDatePicker. Looking at the documentation all I have to do is add the showClearDate attribute to the SingleDatePicker. This is how I've implemented it:



      <SingleDatePicker 
      date=null
      isOutsideRange= (date) => return false
      id=detail.name
      showClearDate=true
      focused=focused
      numberOfMonths= 1
      onDateChange= (date) => handleDateChange( momentToISO(date) )
      onFocusChange=( focused ) =>
      handleFocusChange(focused)


      />


      Evertying works fine if I remove the showClearDate attribute (without showing the button of course) but when I add this attribute in I get an exception "cannot read property onClearDateMouseEnter of undefined"



      The following is taken from the react-dates SingleDatePickerInput.jsx showing where the error is occurring.



       showClearDate && (
      <button
      ...css(
      styles.SingleDatePickerInput_clearDate,
      small && styles.SingleDatePickerInput_clearDate__small,
      !customCloseIcon && styles.SingleDatePickerInput_clearDate__default,
      !displayValue && styles.SingleDatePickerInput_clearDate__hide,
      )
      type="button"
      aria-label=phrases.clearDate
      disabled=disabled
      onMouseEnter=this.onClearDateMouseEnter // here
      onMouseLeave=this.onClearDateMouseLeave // i imagine here too
      onClick=onClearDate
      >
      closeIcon
      </button>
      )


      There is no reference in the documentation to having to supply the function onClearDateMouseEnter function or any other reference to it in code.



      What am I missing here?










      share|improve this question














      I am trying to get the clear date button appearing on the SingleDatePicker. Looking at the documentation all I have to do is add the showClearDate attribute to the SingleDatePicker. This is how I've implemented it:



      <SingleDatePicker 
      date=null
      isOutsideRange= (date) => return false
      id=detail.name
      showClearDate=true
      focused=focused
      numberOfMonths= 1
      onDateChange= (date) => handleDateChange( momentToISO(date) )
      onFocusChange=( focused ) =>
      handleFocusChange(focused)


      />


      Evertying works fine if I remove the showClearDate attribute (without showing the button of course) but when I add this attribute in I get an exception "cannot read property onClearDateMouseEnter of undefined"



      The following is taken from the react-dates SingleDatePickerInput.jsx showing where the error is occurring.



       showClearDate && (
      <button
      ...css(
      styles.SingleDatePickerInput_clearDate,
      small && styles.SingleDatePickerInput_clearDate__small,
      !customCloseIcon && styles.SingleDatePickerInput_clearDate__default,
      !displayValue && styles.SingleDatePickerInput_clearDate__hide,
      )
      type="button"
      aria-label=phrases.clearDate
      disabled=disabled
      onMouseEnter=this.onClearDateMouseEnter // here
      onMouseLeave=this.onClearDateMouseLeave // i imagine here too
      onClick=onClearDate
      >
      closeIcon
      </button>
      )


      There is no reference in the documentation to having to supply the function onClearDateMouseEnter function or any other reference to it in code.



      What am I missing here?







      react-datepicker react-dates






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 9:05









      codetemplarcodetemplar

      334112




      334112






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' of undefined".



          It looks like they fixed it in 17.1.1. Let's see if this helps, I'll test it soon.






          share|improve this answer

























          • Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

            – codetemplar
            Nov 28 '18 at 9:44











          • You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

            – natterstefan
            Nov 29 '18 at 11:15











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277312%2fjavascript-airbnb-react-dates-showcleardate-throwing%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' of undefined".



          It looks like they fixed it in 17.1.1. Let's see if this helps, I'll test it soon.






          share|improve this answer

























          • Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

            – codetemplar
            Nov 28 '18 at 9:44











          • You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

            – natterstefan
            Nov 29 '18 at 11:15
















          0














          I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' of undefined".



          It looks like they fixed it in 17.1.1. Let's see if this helps, I'll test it soon.






          share|improve this answer

























          • Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

            – codetemplar
            Nov 28 '18 at 9:44











          • You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

            – natterstefan
            Nov 29 '18 at 11:15














          0












          0








          0







          I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' of undefined".



          It looks like they fixed it in 17.1.1. Let's see if this helps, I'll test it soon.






          share|improve this answer















          I have a similar issue. I get the same error "SingleDatePickerInput.js:236 Uncaught TypeError: Cannot read property 'onClearDateMouseEnter' of undefined".



          It looks like they fixed it in 17.1.1. Let's see if this helps, I'll test it soon.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 26 '18 at 10:20

























          answered Nov 26 '18 at 10:14









          natterstefannatterstefan

          304313




          304313












          • Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

            – codetemplar
            Nov 28 '18 at 9:44











          • You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

            – natterstefan
            Nov 29 '18 at 11:15


















          • Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

            – codetemplar
            Nov 28 '18 at 9:44











          • You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

            – natterstefan
            Nov 29 '18 at 11:15

















          Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

          – codetemplar
          Nov 28 '18 at 9:44





          Thanks for the reply. I have updated to version 17.1.1. It no longer throws but it doesnt show the clear button.

          – codetemplar
          Nov 28 '18 at 9:44













          You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

          – natterstefan
          Nov 29 '18 at 11:15






          You're welcome. Maybe one of the breaking changes of 17.0.0 caused this issue? github.com/airbnb/react-dates/blob/master/CHANGELOG.md#1700 (Note: I have not yet updated it myself, just saw that 17.1.1 fixed the initial issue during research).

          – natterstefan
          Nov 29 '18 at 11:15


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277312%2fjavascript-airbnb-react-dates-showcleardate-throwing%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo