2015-03-17 20:42:44 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-23 22:07:33 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00: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 20:42:44 +00:00
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2018-08-09 15:32:04 +00:00
|
|
|
* @flow strict-local
|
2015-03-17 20:42:44 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
|
2015-03-17 20:42:44 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const RCTVibration = require('NativeModules').Vibration;
|
2015-03-18 22:57:49 +00:00
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const invariant = require('fbjs/lib/invariant');
|
2015-03-17 20:42:44 +00:00
|
|
|
|
|
|
|
/**
|
2016-03-03 12:08:10 +00:00
|
|
|
* NOTE: `VibrationIOS` is being deprecated. Use `Vibration` instead.
|
|
|
|
*
|
2015-03-17 20:42:44 +00: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 22:44:52 +00:00
|
|
|
const VibrationIOS = {
|
2016-03-03 12:08:10 +00:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2015-03-17 20:42:44 +00:00
|
|
|
vibrate: function() {
|
2018-05-11 02:06:46 +00:00
|
|
|
invariant(arguments[0] === undefined, 'Vibration patterns not supported.');
|
2015-03-17 20:42:44 +00:00
|
|
|
RCTVibration.vibrate();
|
2018-05-11 02:06:46 +00:00
|
|
|
},
|
2015-03-17 20:42:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = VibrationIOS;
|