Remove deprecated calls from StatusBarIOS

Reviewed By: nicklockwood

Differential Revision: D3346701

fbshipit-source-id: 17809a4cd686f3b431257e85d85770aee640bbc9
This commit is contained in:
Pieter De Baets 2016-06-06 08:58:35 -07:00 committed by Facebook Github Bot 0
parent 72b363d7fc
commit 4de616b4c1
3 changed files with 3 additions and 147 deletions

View File

@ -1,118 +0,0 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
StyleSheet,
View,
Text,
TouchableHighlight,
StatusBarIOS,
} = ReactNative;
exports.framework = 'React';
exports.title = 'StatusBarIOS';
exports.description = 'Module for controlling iOS status bar';
exports.examples = [{
title: 'Status Bar Style',
render() {
return (
<View>
{['default', 'light-content'].map((style) =>
<TouchableHighlight key={style} style={styles.wrapper}
onPress={() => StatusBarIOS.setStyle(style)}>
<View style={styles.button}>
<Text>setStyle('{style}')</Text>
</View>
</TouchableHighlight>
)}
</View>
);
},
}, {
title: 'Status Bar Style Animated',
render() {
return (
<View>
{['default', 'light-content'].map((style) =>
<TouchableHighlight key={style} style={styles.wrapper}
onPress={() => StatusBarIOS.setStyle(style, true)}>
<View style={styles.button}>
<Text>setStyle('{style}', true)</Text>
</View>
</TouchableHighlight>
)}
</View>
);
},
}, {
title: 'Status Bar Hidden',
render() {
return (
<View>
{['none', 'fade', 'slide'].map((animation) =>
<View key={animation}>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setHidden(true, animation)}>
<View style={styles.button}>
<Text>setHidden(true, '{animation}')</Text>
</View>
</TouchableHighlight>
<TouchableHighlight style={styles.wrapper}
onPress={() => StatusBarIOS.setHidden(false, animation)}>
<View style={styles.button}>
<Text>setHidden(false, '{animation}')</Text>
</View>
</TouchableHighlight>
</View>
)}
</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({
wrapper: {
borderRadius: 5,
marginBottom: 5,
},
button: {
backgroundColor: '#eeeeee',
padding: 10,
},
});

View File

@ -243,10 +243,6 @@ const APIExamples: Array<UIExplorerExample> = [
key: 'SnapshotExample', key: 'SnapshotExample',
module: require('./SnapshotExample'), module: require('./SnapshotExample'),
}, },
{
key: 'StatusBarIOSExample',
module: require('./StatusBarIOSExample'),
},
{ {
key: 'TimerExample', key: 'TimerExample',
module: require('./TimerExample'), module: require('./TimerExample'),

View File

@ -12,33 +12,11 @@
'use strict'; 'use strict';
const NativeEventEmitter = require('NativeEventEmitter'); const NativeEventEmitter = require('NativeEventEmitter');
const StatusBar = require('StatusBar'); const { StatusBarManager } = require('NativeModules');
const StatusBarManager = require('NativeModules').StatusBarManager;
import type {StatusBarStyle, StatusBarAnimation} from 'StatusBar';
/** /**
* Deprecated. Use `StatusBar` instead. * Use `StatusBar` for mutating the status bar.
*/ */
class StatusBarIOS extends NativeEventEmitter { class StatusBarIOS extends NativeEventEmitter {}
setStyle(style: StatusBarStyle, animated?: boolean) {
console.warn('`StatusBarIOS.setStyle` is deprecated. Use `StatusBar.setBarStyle` instead.');
StatusBar.setBarStyle(style, animated);
}
setHidden(hidden: boolean, animation?: StatusBarAnimation) {
console.warn('`StatusBarIOS.setHidden` is deprecated. Use `StatusBar.setHidden` instead.');
StatusBar.setHidden(hidden, animation);
}
setNetworkActivityIndicatorVisible(visible: boolean) {
console.warn(
'`StatusBarIOS.setNetworkActivityIndicatorVisible` is deprecated. ' +
'Use `StatusBar.setNetworkActivityIndicatorVisible` instead.'
);
StatusBar.setNetworkActivityIndicatorVisible(visible);
}
}
module.exports = new StatusBarIOS(StatusBarManager); module.exports = new StatusBarIOS(StatusBarManager);