-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] DateInput
: isTouchDevice
should only be determined in componentDidMount
#336
Conversation
…onentDidMount`. Fixes #335.
aebef0f
to
18a439e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sweet. This is definitely the fix for #335. I wonder if this is also related to the problem with the Done button showing up for some people on iOS. I will clarify.
const { dateString } = this.state; | ||
const { | ||
dateString, | ||
isTouchDevice: isTouch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about the need for this name change. Can't we just keep this as isTouchDevice
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That identifier name is already used on line 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
@@ -9,5 +9,6 @@ | |||
"rules": { | |||
"no-mixed-operators": [2, { "allowSamePrecedence": true }], | |||
"jsx-a11y/no-static-element-interactions": 1, // TODO: enable | |||
"react/no-did-mount-set-state": 0, // necessary for server-rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we exclusively put this on the DateInput
instead of as a universal exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, but it should be a universal exception, because it's necessary for any component to be server-rendered. I need to disable this rule upstream in the airbnb config too - setState
in componentDidMount
is a good thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? we're fine with a double-render on first mount? I feel like that's something we should work against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every single one of airbnb's hypernova components works like that already. We can definitely strive to avoid it, but it's not possible to avoid for client-required functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's fair, but given that this repo is small, I would prefer to turn it off on a case by case basis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer that I can do it - but we might need to make the same change in any component that has touch detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okeedoke.
const { dateString } = this.state; | ||
const { | ||
dateString, | ||
isTouchDevice: isTouch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
18a439e
to
d978e54
Compare
Fixes #335.