mirror of
https://github.com/status-im/react-native.git
synced 2025-01-25 00:39:03 +00:00
[StatusBar] Add ability to toggle the network activity indicator in the status bar + example in UIExplorer
Summary: Added the ability to turn on and off the network activity indicator using: ``` StatusBarIOS.setNetworkActivityIndicatorVisible(true) ``` and ``` StatusBarIOS.setNetworkActivityIndicatorVisible(false) ``` Also added an example to the UIExplorer example app. Fix #986 Closes https://github.com/facebook/react-native/pull/2079 Github Author: Mark Miyashita <negativetwelve@gmail.com>
This commit is contained in:
parent
3fa3963465
commit
10ffe170c2
@ -83,6 +83,26 @@ exports.examples = [{
|
||||
</View>
|
||||
);
|
||||
},
|
||||
}, {
|
||||
title: 'Status Bar Network Activity Indicator',
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<TouchableHighlight style={styles.wrapper}
|
||||
onPress={() => StatusBarIOS.setNetworkActivityIndicatorVisible(true)}>
|
||||
<View style={styles.button}>
|
||||
<Text>setNetworkActivityIndicatorVisible(true)</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight style={styles.wrapper}
|
||||
onPress={() => StatusBarIOS.setNetworkActivityIndicatorVisible(false)}>
|
||||
<View style={styles.button}>
|
||||
<Text>setNetworkActivityIndicatorVisible(false)</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
);
|
||||
},
|
||||
}];
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
|
@ -35,6 +35,10 @@ var StatusBarIOS = {
|
||||
animation = animation || 'none';
|
||||
RCTStatusBarManager.setHidden(hidden, animation);
|
||||
},
|
||||
|
||||
setNetworkActivityIndicatorVisible(visible: boolean) {
|
||||
RCTStatusBarManager.setNetworkActivityIndicatorVisible(visible);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = StatusBarIOS;
|
||||
|
@ -71,4 +71,9 @@ RCT_EXPORT_METHOD(setHidden:(BOOL)hidden
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible:(BOOL)visible)
|
||||
{
|
||||
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:visible];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user