Mark setNetworkActivityIndicatorVisible as deprecated (#45950)

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

Changelog:

[iOS][Deprecated] Deprecated StatusBar.setNetworkActivityIndicatorVisible

The status bar network activity indicator is deprecated in iOS 13. Setting its visibility has no effect in iOS 13 and later. It will be completely removed in a future release.

Reviewed By: philIip

Differential Revision: D60977517

fbshipit-source-id: 31e79113fffd0201c4393b61236d3911e82b40d1
This commit is contained in:
Ingrid Wang authored and Facebook GitHub Bot committed 2024-08-08 16:27:49 -07:00
1 parent 270951a212
commit 8a390ba9b8
3 files changed
+7 -64

No files matched your search

@@ -272,8 +272,10 @@ class StatusBar extends React.Component<Props> {
}
/**
* Control the visibility of the network activity indicator
* DEPRECATED - The status bar network activity indicator is not supported in iOS 13 and later. This will be removed in a future release.
* @param visible Show the indicator.
*
* @deprecated
*/
static setNetworkActivityIndicatorVisible(visible: boolean) {
if (Platform.OS !== 'ios') {
@@ -161,7 +161,11 @@ RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnima
RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
{
dispatch_async(dispatch_get_main_queue(), ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// This is no longer supported in iOS 13 and later. We will remove this method in a future release.
RCTSharedApplication().networkActivityIndicatorVisible = visible;
#pragma clang diagnostic pop
});
}
@@ -149,44 +149,6 @@ class StatusBarStyleExample extends React.Component<{...}, $FlowFixMeState> {
}
}
class StatusBarNetworkActivityExample extends React.Component<
{...},
$FlowFixMeState,
> {
state: $FlowFixMe | {networkActivityIndicatorVisible: boolean} = {
networkActivityIndicatorVisible: false,
};
_onChangeNetworkIndicatorVisible = () => {
this.setState({
networkActivityIndicatorVisible:
!this.state.networkActivityIndicatorVisible,
});
};
render(): React.Node {
return (
<View>
<StatusBar
networkActivityIndicatorVisible={
this.state.networkActivityIndicatorVisible
}
/>
<TouchableHighlight
style={styles.wrapper}
onPress={this._onChangeNetworkIndicatorVisible}>
<View style={styles.button}>
<Text>
networkActivityIndicatorVisible:
{this.state.networkActivityIndicatorVisible ? 'true' : 'false'}
</Text>
</View>
</TouchableHighlight>
</View>
);
}
}
class StatusBarBackgroundColorExample extends React.Component<
{...},
$FlowFixMeState,
@@ -308,24 +270,6 @@ class StatusBarStaticIOSExample extends React.Component<{...}> {
<Text>setBarStyle('light-content', true)</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => {
StatusBar.setNetworkActivityIndicatorVisible(true);
}}>
<View style={styles.button}>
<Text>setNetworkActivityIndicatorVisible(true)</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => {
StatusBar.setNetworkActivityIndicatorVisible(false);
}}>
<View style={styles.button}>
<Text>setNetworkActivityIndicatorVisible(false)</Text>
</View>
</TouchableHighlight>
</View>
);
}
@@ -490,13 +434,6 @@ exports.examples = [
return <StatusBarStyleExample />;
},
},
{
title: 'StatusBar network activity indicator',
render(): React.Node {
return <StatusBarNetworkActivityExample />;
},
platform: 'ios',
},
{
title: 'StatusBar background color',
render(): React.Node {