refactor!: drop deprecated StatusBarIOS (#31466)

Summary:
This component has been merged with `StatusBar` and deprecated since [Jun 24, 2019](https://github.com/facebook/react-native/commit/a8337785539d572009d2cc4263aef7755ae03097)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[JavaScript] [Removed] - refactor!: drop deprecated `StatusBarIOS`

Pull Request resolved: https://github.com/facebook/react-native/pull/31466

Test Plan: Warning when user imports `StatusBarIOS`

Reviewed By: yungsters

Differential Revision: D30109324

Pulled By: lunaleaps

fbshipit-source-id: fa2d3aa2cf35206ed8a196e09f12af57d3b61ccc
This commit is contained in:
Luis Miguel Alvarado
2021-08-04 21:14:46 -07:00
committed by Facebook GitHub Bot
parent a169009095
commit 7ce0f40f5c
2 changed files with 22 additions and 52 deletions
@@ -1,38 +0,0 @@
/**
* 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);
+22 -14
View File
@@ -77,7 +77,6 @@ import typeof PixelRatio from './Libraries/Utilities/PixelRatio';
import typeof PushNotificationIOS from './Libraries/PushNotificationIOS/PushNotificationIOS';
import typeof Settings from './Libraries/Settings/Settings';
import typeof Share from './Libraries/Share/Share';
import typeof StatusBarIOS from './Libraries/Components/StatusBar/StatusBarIOS';
import typeof StyleSheet from './Libraries/StyleSheet/StyleSheet';
import typeof Systrace from './Libraries/Performance/Systrace';
import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid';
@@ -384,13 +383,6 @@ module.exports = {
get Share(): Share {
return require('./Libraries/Share/Share');
},
get StatusBarIOS(): StatusBarIOS {
warnOnce(
'StatusBarIOS-merged',
'StatusBarIOS has been merged with StatusBar and will be removed in a future release. Use StatusBar for mutating the status bar',
);
return require('./Libraries/Components/StatusBar/StatusBarIOS');
},
get StyleSheet(): StyleSheet {
return require('./Libraries/StyleSheet/StyleSheet');
},
@@ -679,17 +671,17 @@ if (__DEV__) {
});
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
* attempting to access Picker. */
* attempting to access StatusBarIOS. */
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
* attempting to access Picker. */
Object.defineProperty(module.exports, 'Picker', {
* attempting to access StatusBarIOS. */
Object.defineProperty(module.exports, 'StatusBarIOS', {
configurable: true,
get() {
invariant(
false,
'Picker has been removed from React Native. ' +
"It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " +
'See https://github.com/react-native-picker/picker',
'StatusBarIOS has been removed from React Native. ' +
'Has been merged with StatusBar. ' +
'See https://reactnative.dev/docs/statusbar',
);
},
});
@@ -709,4 +701,20 @@ if (__DEV__) {
);
},
});
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
* attempting to access Picker. */
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
* attempting to access Picker. */
Object.defineProperty(module.exports, 'Picker', {
configurable: true,
get() {
invariant(
false,
'Picker has been removed from React Native. ' +
"It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " +
'See https://github.com/react-native-picker/picker',
);
},
});
}