W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
震動 API 是在 VibrationIOS.vibrate()
里顯示的。在 iOS 上,調(diào)用這個函數(shù)可以出發(fā)一秒鐘的振動。振動是異步的,所以這個方法會立即返回。
這對不支持振動的設(shè)備是沒有任何影響的,例如,iOS 模擬器。
目前是不支持振動模式的。
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號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: