Flow strict-local in TimePickerAndroid.android.js (#22188)

Summary:
Related to #22100 . I had this issue before(#22154 & #22172).

Turn Flow strict mode on for Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js.

- [x] npm run prettier
- [x] npm run flow
- [x] npm run flow-check-ios
- [x] npm run flow-check-android
- [x] npm run lint
- [x] npm run test
- [x] ./scripts/run-android-local-unit-tests.sh

[GENERAL][ENHANCEMENT][TimePickerAndroid.android.js] - apply flow strict-local
Pull Request resolved: https://github.com/facebook/react-native/pull/22188

Reviewed By: TheSavior

Differential Revision: D12972356

Pulled By: RSNara

fbshipit-source-id: 838604a791dfdc86bacf8b49f6c399920a3f57bc
This commit is contained in:
Tnarita0000 2018-11-21 14:32:55 -08:00 коммит произвёл Facebook Github Bot
Родитель fb4825a2c6
Коммит c127000a7d
2 изменённых файлов: 33 добавлений и 8 удалений

Просмотреть файл

@ -5,13 +5,18 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @flow strict-local
*/
'use strict';
const TimePickerModule = require('NativeModules').TimePickerAndroid;
import type {
TimePickerOptions,
TimePickerResult,
} from './TimePickerAndroidTypes';
/**
* Opens the standard Android time picker dialog.
*
@ -52,22 +57,18 @@ class TimePickerAndroid {
* still be resolved with action being `TimePickerAndroid.dismissedAction` and all the other keys
* being undefined. **Always** check whether the `action` before reading the values.
*/
static async open(options: Object): Promise<Object> {
static async open(options: TimePickerOptions): Promise<TimePickerResult> {
return TimePickerModule.open(options);
}
/**
* A time has been selected.
*/
static get timeSetAction() {
return 'timeSetAction';
}
static +timeSetAction: 'timeSetAction' = 'timeSetAction';
/**
* The dialog has been dismissed.
*/
static get dismissedAction() {
return 'dismissedAction';
}
static +dismissedAction: 'dismissedAction' = 'dismissedAction';
}
module.exports = TimePickerAndroid;

Просмотреть файл

@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
'use strict';
export type TimePickerOptions = {|
hour?: number,
minute?: number,
is24Hour?: boolean,
mode?: 'clock' | 'spinner' | 'default',
|};
export type TimePickerResult = $ReadOnly<{|
action: string,
hour: number,
minute: number,
|}>;