'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
StyleSheet,
View,
Text,
TouchableHighlight,
Vibration,
} = ReactNative;
exports.framework = 'React';
exports.title = 'Vibration';
exports.description = 'Vibration API';
exports.examples = [
{
title: 'Vibration.vibrate()',
render() {
return (
<TouchableHighlight
style={styles.wrapper}
onPress={() => Vibration.vibrate()}>
<View style={styles.button}>
<Text>Vibrate</Text>
</View>
</TouchableHighlight>
);
},
},
{
title: 'Vibration.vibrate([0, 500, 200, 500])',
render() {
return (
<TouchableHighlight
style={styles.wrapper}
onPress={() => Vibration.vibrate([0, 500, 200, 500])}>
<View style={styles.button}>
<Text>Vibrate once</Text>
</View>
</TouchableHighlight>
);
},
},
{
title: 'Vibration.vibrate([0, 500, 200, 500], true)',
render() {
return (
<TouchableHighlight
style={styles.wrapper}
onPress={() => Vibration.vibrate([0, 500, 200, 500], true)}>
<View style={styles.button}>
<Text>Vibrate until cancel</Text>
</View>
</TouchableHighlight>
);
},
},
{
title: 'Vibration.cancel()',
render() {
return (
<TouchableHighlight
style={styles.wrapper}
onPress={() => Vibration.cancel()}>
<View style={styles.button}>
<Text>Cancel</Text>
</View>
</TouchableHighlight>
);
},
},
];
var styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
},
button: {
backgroundColor: '#eeeeee',
padding: 10,
},
});