Skip to content
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

[flow-strict] Flow strict-local in TimePickerAndroid.android.js #22172

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @flow strict-local
*/

'use strict';

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

import type {Options, TimePickerAndroidEvent} from './TimePickerAndroidTypes';

/**
* Opens the standard Android time picker dialog.
*
Expand Down Expand Up @@ -52,22 +54,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: Options): Promise<TimePickerAndroidEvent> {
return TimePickerModule.open(options);
}

/**
* A time has been selected.
*/
static get timeSetAction() {
return 'timeSetAction';
}
static +timeSetAction: string = 'timeSetAction';
/**
* The dialog has been dismissed.
*/
static get dismissedAction() {
return 'dismissedAction';
}
static +dismissedAction: string = 'dismissedAction';
}

module.exports = TimePickerAndroid;
28 changes: 28 additions & 0 deletions Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* 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';

import type {SyntheticEvent} from 'CoreEventTypes';

export type Options = {
hour: number,
minute: number,
is24Hour: boolean,
mode: 'clock' | 'spinner' | 'default',
};

export type TimePickerAndroidEvent = SyntheticEvent<
$ReadOnly<{|
action: string,
hour: number,
minute: number,
|}>,
>;