react-native-paper-dates icon indicating copy to clipboard operation
react-native-paper-dates copied to clipboard

Is there any way to eliminate the writing field in DatePickerModal?

Open airam666 opened this issue 4 years ago • 16 comments
trafficstars

DatePickerModal componen allows the mobile user to write the date on themselves. I would like to know if there's an chance that I could stop that from happening. Maybe with a property?

airam666 avatar Mar 18 '21 19:03 airam666

Why? What are you worried for? You can provide a min and max ad validRange and the component will always return valid dates otherwise the old date is used

RichardLindhout avatar Mar 18 '21 19:03 RichardLindhout

I am getting errors and my app restarts when I write on it. I would like to have an option to disable that field.

airam666 avatar Mar 19 '21 03:03 airam666

We should fix that then, what version are you on? We fixed it in v4+ the app should not crash anymore.

RichardLindhout avatar Mar 19 '21 09:03 RichardLindhout

yeah but I keep updating the library and still get the same issue. so it would help me if I could disable the field. Is it possible?. I am using 0.4.0, now I updated to 0.4.1 but to no avail. I still have that problem.

airam666 avatar Mar 19 '21 11:03 airam666

I don’t want to disable it I want to fix the the root issue. What is the date you are filling in and which platform, which timezone and which locale are you in?

Op vr 19 mrt. 2021 om 12:39 schreef María Palacios @.***

yeah but I keep updating the library and still get the same issue. so it would help me if I could disable the field. Is it possible?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/web-ridge/react-native-paper-dates/issues/59#issuecomment-802771779, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRARKONCIK5PNML6UV3I3TEMZXDANCNFSM4ZNH5D3Q .

--

Richard Lindhout | Eigenaar Bel mij +31 6 43 42 45 67 <+31643424567>

Beatrixlaan 2, 4694EG Scherpenisse

KVK 56845367 BTW NL002365659B60 IBAN NL93 BUNQ 2038 9661 33 WEB webRidge.nl https://webRidge.nl

RichardLindhout avatar Mar 19 '21 11:03 RichardLindhout

ah I'm validating it with momentjs I don't know if it has something to do with it

airam666 avatar Mar 19 '21 16:03 airam666

Try to debug with console.log() before you check with momentJS, maybe it crashes before. Can you trigger the issue on reactnativepaperdates.com?

RichardLindhout avatar Mar 22 '21 18:03 RichardLindhout

No, it crashes while writing. I did a console.log() and it crashes while I write the date

airam666 avatar Mar 23 '21 11:03 airam666

how would the dateRange validation be in that case?

airam666 avatar Mar 25 '21 19:03 airam666

dateRange validation is here: https://github.com/web-ridge/react-native-paper-dates/blob/d783ee57cc9efff93692810fe9e17086946be25c/src/Date/dateUtils.tsx#L107

RichardLindhout avatar Apr 07 '21 20:04 RichardLindhout

Also bumped into this problem. Was able to recreate it on reactnativepaperdates.com

Steps:

  • click pick a single date
  • click the edit icon
  • in the input, navigate with cursor onto year 2021, between 20 and 21
  • write a / character

Browser logs Uncaught TypeError: Cannot read property 'length' of undefined. iOS simulator freezes. Android emulator restarts the app. (simulators were tested on a project and not reactnativepaperdates.com, but we get the same error in the browser and not doing anything fancy that could cause this).

Screencast showcasing the issue: https://www.screencast.com/t/O3cEYZCG

This is indeed an edge case, but can happen.

hizo avatar Jun 11 '21 08:06 hizo

I'll fix the crashing issue within 2 weeks!

RichardLindhout avatar Jun 11 '21 10:06 RichardLindhout

@RichardLindhout Is it possible to keep this configurable? Basically my UX team wants to use this picker, but they don't want the edit button at the top. I understand it's your concept and you would like it to work properly. But it can be helpful if there is a flag which prevents the display of edit button. Something on the lines of disableManualEntry which can be false by default, so only people who actually need to disable it can do so.

vvdwivedi avatar Jun 19 '21 12:06 vvdwivedi

@RichardLindhout any update on this please?

hizo avatar Jul 27 '21 13:07 hizo

Hey I'm really sorry I'm really short on time a.t.m. but would be fine if we can disable this with a prop, but I want to fix the crash first not disabling first

RichardLindhout avatar Jul 27 '21 21:07 RichardLindhout

Thanks for the PR @ airam666, can you maybe please also check how to prevent the crash with wrong dates and update the PR. I'll merge it then!

RichardLindhout avatar Oct 20 '21 23:10 RichardLindhout