Skip to content

Commit

Permalink
refactor!: drop deprecated StatusBarIOS (#31466)
Browse files Browse the repository at this point in the history
Summary:
This component has been merged with `StatusBar` and deprecated since [Jun 24, 2019](a833778)

## 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: #31466

Test Plan: Warning when user imports `StatusBarIOS`

Reviewed By: yungsters

Differential Revision: D30109324

Pulled By: lunaleaps

fbshipit-source-id: fa2d3aa2cf35206ed8a196e09f12af57d3b61ccc
  • Loading branch information
ecreeth authored and facebook-github-bot committed Aug 5, 2021
1 parent a169009 commit 7ce0f40
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 52 deletions.
38 changes: 0 additions & 38 deletions Libraries/Components/StatusBar/StatusBarIOS.js

This file was deleted.

36 changes: 22 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
},
Expand Down Expand Up @@ -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',
);
},
});
Expand All @@ -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',
);
},
});
}

1 comment on commit 7ce0f40

@danielgindi
Copy link
Contributor

@danielgindi danielgindi commented on 7ce0f40 Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#32297

Previously we could have done this:

StatusBarIOS.addListener('statusBarFrameWillChange', ...)
StatusBarIOS.addListener('statusBarFrameDidChange', ...)

To get status bar frame change events on iOS.
Now the event still exists - in native code - but not accessible anymore as it has not migrated when deprecating StatusBarIOS.

So this is not only a breaking change, but a breaking change without an alternative.

Please sign in to comment.