Skip to content

Commit

Permalink
[StatusBar] Add ability to toggle the network activity indicator in t…
Browse files Browse the repository at this point in the history
…he 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 facebook#986
Closes facebook#2079
Github Author: Mark Miyashita <negativetwelve@gmail.com>
  • Loading branch information
negativetwelve authored and ptmt committed Jul 28, 2015
1 parent 08f53fb commit 7995e0c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Examples/UIExplorer/StatusBarIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 4 additions & 0 deletions Libraries/Components/StatusBar/StatusBarIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ var StatusBarIOS = {
animation = animation || 'none';
RCTStatusBarManager.setHidden(hidden, animation);
},

setNetworkActivityIndicatorVisible(visible: boolean) {
RCTStatusBarManager.setNetworkActivityIndicatorVisible(visible);
},
};

module.exports = StatusBarIOS;
5 changes: 5 additions & 0 deletions React/Modules/RCTStatusBarManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,9 @@ - (dispatch_queue_t)methodQueue
}
}

RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible:(BOOL)visible)
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:visible];
}

@end

0 comments on commit 7995e0c

Please sign in to comment.