Respecting readOnly prop
See original GitHub issueHowdy,
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 theDateInput
component) - we remove the default value of
isTouch
to be false in theDateInput
component.
Let me know which you prefer and I’ll make a pr. Thank you!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ljharb You haven’t mentioned why
DateInput
dictates 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.
Will be in the next release! ✌️