2015-03-17 13:42:44 -07:00
|
|
|
/**
|
2015-03-23 15:07:33 -07:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-03-17 13:42:44 -07:00
|
|
|
*
|
2018-05-10 19:06:46 -07:00
|
|
|
* @format
|
2015-03-24 09:26:16 -07:00
|
|
|
* @flow
|
2015-03-17 13:42:44 -07:00
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
|
2015-03-17 13:42:44 -07:00
|
|
|
'use strict';
|
|
|
|
|
2018-05-10 15:44:52 -07:00
|
|
|
const RCTVibration = require('NativeModules').Vibration;
|
2015-03-18 15:57:49 -07:00
|
|
|
|
2018-05-10 15:44:52 -07:00
|
|
|
const invariant = require('fbjs/lib/invariant');
|
2015-03-17 13:42:44 -07:00
|
|
|
|
|
|
|
/**
|
2016-03-03 04:08:10 -08:00
|
|
|
* NOTE: `VibrationIOS` is being deprecated. Use `Vibration` instead.
|
|
|
|
*
|
2015-03-17 13:42:44 -07:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2018-05-10 15:44:52 -07:00
|
|
|
const VibrationIOS = {
|
2016-03-03 04:08:10 -08:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2015-03-17 13:42:44 -07:00
|
|
|
vibrate: function() {
|
2018-05-10 19:06:46 -07:00
|
|
|
invariant(arguments[0] === undefined, 'Vibration patterns not supported.');
|
2015-03-17 13:42:44 -07:00
|
|
|
RCTVibration.vibrate();
|
2018-05-10 19:06:46 -07:00
|
|
|
},
|
2015-03-17 13:42:44 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = VibrationIOS;
|