mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fa406ac2aa
Summary: Adds types to Event Emitters and migrates the most relevant modules using them in `react-native`. The most relevant file of this diff is `react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js` with the Flow tests showing and testing the behavior of the new types Changelog: [Internal] Add types for Event Emitters and subclasses Reviewed By: motiz88 Differential Revision: D25587936 fbshipit-source-id: feeb09f9ad15d383cdd82deaaaba0d12b94e868b
36 lines
876 B
JavaScript
36 lines
876 B
JavaScript
/**
|
|
* 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 NativeEventEmitter from '../../EventEmitter/NativeEventEmitter';
|
|
import NativeStatusBarManagerIOS from './NativeStatusBarManagerIOS';
|
|
|
|
type StatusBarFrameChangeEvent = {
|
|
frame: {
|
|
x: number,
|
|
y: number,
|
|
width: number,
|
|
height: number,
|
|
},
|
|
};
|
|
|
|
type StatusBarIOSEventDefinitions = {
|
|
statusBarFrameDidChange: [StatusBarFrameChangeEvent],
|
|
statusBarFrameWillChange: [StatusBarFrameChangeEvent],
|
|
};
|
|
|
|
/**
|
|
* Use `StatusBar` for mutating the status bar.
|
|
*/
|
|
class StatusBarIOS extends NativeEventEmitter<StatusBarIOSEventDefinitions> {}
|
|
|
|
module.exports = (new StatusBarIOS(NativeStatusBarManagerIOS): StatusBarIOS);
|