Skip to content

Commit 9e48430

Browse files
binarytafacebook-github-bot
authored andcommitted
Flow strict-local in TimePickerAndroid.android.js (facebook#22188)
Summary: Related to facebook#22100 . I had this issue before(facebook#22154 & facebook#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: facebook#22188 Reviewed By: TheSavior Differential Revision: D12972356 Pulled By: RSNara fbshipit-source-id: 838604a791dfdc86bacf8b49f6c399920a3f57bc
1 parent 25e2887 commit 9e48430

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @format
8-
* @flow
8+
* @flow strict-local
99
*/
1010

1111
'use strict';
1212

1313
const TimePickerModule = require('NativeModules').TimePickerAndroid;
1414

15+
import type {
16+
TimePickerOptions,
17+
TimePickerResult,
18+
} from './TimePickerAndroidTypes';
19+
1520
/**
1621
* Opens the standard Android time picker dialog.
1722
*
@@ -52,22 +57,18 @@ class TimePickerAndroid {
5257
* still be resolved with action being `TimePickerAndroid.dismissedAction` and all the other keys
5358
* being undefined. **Always** check whether the `action` before reading the values.
5459
*/
55-
static async open(options: Object): Promise<Object> {
60+
static async open(options: TimePickerOptions): Promise<TimePickerResult> {
5661
return TimePickerModule.open(options);
5762
}
5863

5964
/**
6065
* A time has been selected.
6166
*/
62-
static get timeSetAction() {
63-
return 'timeSetAction';
64-
}
67+
static +timeSetAction: 'timeSetAction' = 'timeSetAction';
6568
/**
6669
* The dialog has been dismissed.
6770
*/
68-
static get dismissedAction() {
69-
return 'dismissedAction';
70-
}
71+
static +dismissedAction: 'dismissedAction' = 'dismissedAction';
7172
}
7273

7374
module.exports = TimePickerAndroid;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
8+
* @flow strict-local
9+
*/
10+
11+
'use strict';
12+
13+
export type TimePickerOptions = {|
14+
hour?: number,
15+
minute?: number,
16+
is24Hour?: boolean,
17+
mode?: 'clock' | 'spinner' | 'default',
18+
|};
19+
20+
export type TimePickerResult = $ReadOnly<{|
21+
action: string,
22+
hour: number,
23+
minute: number,
24+
|}>;

0 commit comments

Comments
 (0)