From 7ce0f40f5cd8c0928ce720d6d121bcc5963958a2 Mon Sep 17 00:00:00 2001 From: Luis Miguel Alvarado Date: Wed, 4 Aug 2021 21:13:31 -0700 Subject: [PATCH] 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 [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 --- .../Components/StatusBar/StatusBarIOS.js | 38 ------------------- index.js | 36 +++++++++++------- 2 files changed, 22 insertions(+), 52 deletions(-) delete mode 100644 Libraries/Components/StatusBar/StatusBarIOS.js diff --git a/Libraries/Components/StatusBar/StatusBarIOS.js b/Libraries/Components/StatusBar/StatusBarIOS.js deleted file mode 100644 index be8ee04add4faa..00000000000000 --- a/Libraries/Components/StatusBar/StatusBarIOS.js +++ /dev/null @@ -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 {} - -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); diff --git a/index.js b/index.js index 7f522811774ff0..545554b3b39ab0 100644 --- a/index.js +++ b/index.js @@ -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', + ); + }, + }); }