diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js index bdb29421f89d0e..c83a3b854fa8b2 100644 --- a/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js +++ b/Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js @@ -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. * @@ -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 { + static async open(options: Options): Promise { 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; diff --git a/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js b/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js new file mode 100644 index 00000000000000..d19a7887853569 --- /dev/null +++ b/Libraries/Components/TimePickerAndroid/TimePickerAndroidTypes.js @@ -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, + |}>, +>;