-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Turn Flow strict mode on for KeyBoard #22114
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow | ||
* @flow strict-local | ||
*/ | ||
|
||
'use strict'; | ||
|
@@ -121,7 +121,10 @@ let Keyboard = { | |
* @param {string} eventName The `nativeEvent` is the string that identifies the event you're listening for. | ||
* @param {function} callback function to be called when the event fires. | ||
*/ | ||
removeListener(eventName: KeyboardEventName, callback: Function) { | ||
removeListener( | ||
eventName: KeyboardEventName, | ||
callback: KeyboardEventListener, | ||
) { | ||
invariant(false, 'Dummy method used for documentation'); | ||
}, | ||
|
||
|
@@ -155,12 +158,12 @@ Keyboard = KeyboardEventEmitter; | |
Keyboard.dismiss = dismissKeyboard; | ||
Keyboard.scheduleLayoutAnimation = function(event: KeyboardEvent) { | ||
const {duration, easing} = event; | ||
if (duration) { | ||
if (duration != null) { | ||
LayoutAnimation.configureNext({ | ||
duration: duration, | ||
update: { | ||
duration: duration, | ||
type: (easing && LayoutAnimation.Types[easing]) || 'keyboard', | ||
type: (easing != null && LayoutAnimation.Types[easing]) || 'keyboard', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 This one doesn't need the check for empty string because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, the |
||
}, | ||
}); | ||
} | ||
|
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 changes the behavior in the case that duration is 0. If you add the explicit check for that then flow should be okay.
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.
👍