mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 13:03:08 +08:00
vibration module
Summary:I will fix other notes from https://github.com/facebook/react-native/pull/2794 if I get positive feedback. Closes https://github.com/facebook/react-native/pull/6061 Reviewed By: nicklockwood Differential Revision: D2982173 Pulled By: dmmiller fb-gh-sync-id: d1e9407798b0293b090897a10996085b0f0c1b3e shipit-source-id: d1e9407798b0293b090897a10996085b0f0c1b3e
This commit is contained in:
committed by
Facebook Github Bot 7
parent
d2d00e0fcd
commit
1bab7c5182
@@ -162,6 +162,10 @@ const APIExamples = [
|
||||
key: 'ToastAndroidExample',
|
||||
module: require('./ToastAndroidExample'),
|
||||
},
|
||||
{
|
||||
key: 'VibrationExample',
|
||||
module: require('./VibrationExample'),
|
||||
},
|
||||
{
|
||||
key: 'XHRExample',
|
||||
module: require('./XHRExample'),
|
||||
|
||||
@@ -245,8 +245,8 @@ var APIExamples: Array<UIExplorerExample> = [
|
||||
module: require('./TransformExample'),
|
||||
},
|
||||
{
|
||||
key: 'VibrationIOSExample',
|
||||
module: require('./VibrationIOSExample'),
|
||||
key: 'VibrationExample',
|
||||
module: require('./VibrationExample'),
|
||||
},
|
||||
{
|
||||
key: 'XHRExample',
|
||||
|
||||
54
Examples/UIExplorer/VibrationExample.js
Normal file
54
Examples/UIExplorer/VibrationExample.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 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-native');
|
||||
var {
|
||||
StyleSheet,
|
||||
View,
|
||||
Text,
|
||||
TouchableHighlight,
|
||||
Vibration,
|
||||
} = React;
|
||||
|
||||
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>
|
||||
);
|
||||
},
|
||||
}];
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
borderRadius: 5,
|
||||
marginBottom: 5,
|
||||
},
|
||||
button: {
|
||||
backgroundColor: '#eeeeee',
|
||||
padding: 10,
|
||||
},
|
||||
});
|
||||
@@ -6,6 +6,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
||||
Reference in New Issue
Block a user