mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
f8ab8415d5
Summary: * Exposed as `VibrationIOS.vibrate();` * Included a UI Explorer example. * Vibration patterns are currently unsupported as there is no API to produce a vibration of less than 1 second on iOS. Closes https://github.com/facebook/react-native/pull/154 Github Author: Joe Stanton <joe.stanton@red-badger.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
33 lines
774 B
JavaScript
33 lines
774 B
JavaScript
/**
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
*
|
|
* @providesModule VibrationIOS
|
|
*/
|
|
'use strict';
|
|
|
|
var {RCTVibration} = require('NativeModules');
|
|
var invariant = require('invariant');
|
|
|
|
/**
|
|
* The Vibration API is exposed at `VibrationIOS.vibrate()`. On iOS, calling this
|
|
* function will trigger a one second vibration. The vibration is asynchronous
|
|
* so this method will return immediately.
|
|
*
|
|
* There will be no effect on devices that do not support Vibration, eg. the iOS
|
|
* simulator.
|
|
*
|
|
* Vibration patterns are currently unsupported.
|
|
*/
|
|
|
|
var VibrationIOS = {
|
|
vibrate: function() {
|
|
invariant(
|
|
arguments[0] === undefined,
|
|
'Vibration patterns not supported.'
|
|
);
|
|
RCTVibration.vibrate();
|
|
}
|
|
};
|
|
|
|
module.exports = VibrationIOS;
|