W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
震動(dòng) API 是在 VibrationIOS.vibrate()
里顯示的。在 iOS 上,調(diào)用這個(gè)函數(shù)可以出發(fā)一秒鐘的振動(dòng)。振動(dòng)是異步的,所以這個(gè)方法會(huì)立即返回。
這對(duì)不支持振動(dòng)的設(shè)備是沒(méi)有任何影響的,例如,iOS 模擬器。
目前是不支持振動(dòng)模式的。
static vibrate()
'use strict';var React = require('react-native');var { StyleSheet, View, Text, TouchableHighlight, VibrationIOS } = React; exports.framework = 'React'; exports.title = 'VibrationIOS'; exports.description = 'Vibration API for iOS'; exports.examples = [{ title: 'VibrationIOS.vibrate()', render() { return ( <TouchableHighlight style={styles.wrapper} onPress={() => VibrationIOS.vibrate()}> <View style={styles.button}> <Text>Vibrate</Text> </View> </TouchableHighlight> ); }, }];var styles = StyleSheet.create({ wrapper: { borderRadius: 5, marginBottom: 5, }, button: { backgroundColor: '#eeeeee', padding: 10, }, });
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: