Files
react-native/Libraries/Components/StatusBar/StatusBarIOS.js
T
Rubén Norte 38cfa93775 Migrate remaining modules using NativeEventEmitter to only pass the native module on iOS
Summary: Changelog: [Internal]

Reviewed By: fred2028

Differential Revision: D27501270

fbshipit-source-id: 1d447017e862baf834310650778f2abbff50945c
2021-04-12 06:27:20 -07:00

39 lines
1.2 KiB
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
*/
import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter';
import NativeStatusBarManagerIOS from './NativeStatusBarManagerIOS';
import Platform from '../../Utilities/Platform';
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(
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
// If you want to use the native module on other platforms, please remove this condition and test its behavior
Platform.OS !== 'ios' ? null : NativeStatusBarManagerIOS,
): StatusBarIOS);