question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Respecting readOnly prop

See original GitHub issue

Howdy,

SingleDatePicker.jsx I am able to pass in the readOnly prop but it only works if the prop itself is true. If I specify false, it’s not respected on touch devices because of the isTouch logic here.

There are two ways of solving this:

  • react-dates stops enforcing behavior on touch devices (ripping out the isTouch logic in the DateInput component)
  • we remove the default value of isTouch to be false in the DateInput component.

Let me know which you prefer and I’ll make a pr. Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aschiopucommented, Jun 14, 2017

In other words, I don’t think either of your suggestions is a good way to solve this.

@ljharb You haven’t mentioned why DateInputdictates the behavior of the component on different devices? It’s something that the consuming parent component can dictate easily making this component more flexible and re-usable.

@majapw I understand the reasoning behind having it read only for most touch devices, except the Surface and most windows laptops. More and more windows laptops come out with touch screens, yet they still have a keyboard and mouse.

Overall I think think this behavior/logic should probably be dictated by the parent consuming component as it relies on the devices that use of this component. The windows machines might not be the case at AirBnB, but it could be true at other companies.

0reactions
majapwcommented, Jun 28, 2017

Will be in the next release! ✌️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Respecting readOnly prop · Issue #560 · react-dates ... - GitHub
I am able to pass in the readOnly prop but it only works if the prop itself is true. If I specify false,...
Read more >
Why props in React are read only? - Stack Overflow
The important concept of React component: a component should only manage its own state, but it should not manage its own props.
Read more >
Change ReadOnly attribute on property doesn't work
The video property has an Editor defined on it, and that editor is responsible for the readonly checking, try removing it.
Read more >
7. Send custom data to the components using read-only props ...
Hi FriendsIn this video, we will see how to send the custom data to both functional and class components using read-only props and...
Read more >
Read only properties do not respect custom conventions
The conventions are not respected for the read only property Prop2 : its name is not camel case (first letter is upper case) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found