mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
3904228704
Summary: This PR fixes a compatibility issue with the Vibration module and TurboModules. The TurboModules spec doesn't allow nullable arguments of type Number, causing the following problem:  ## Changelog [iOS] [Fixed] - Make Vibration library compatible with TurboModules. Pull Request resolved: https://github.com/facebook/react-native/pull/27951 Test Plan: Just submitted a PR to my own app to fix the issue [here](https://github.com/rainbow-me/rainbow/pull/340) The problem should be reproducible on RNTester due to this line: https://github.com/facebook/react-native/blob/91f139b94118fe8db29728ea8ad855fc4a13f743/RNTester/js/examples/Vibration/VibrationExample.js#L66 and should be working on this branch. Reviewed By: TheSavior Differential Revision: D19761064 Pulled By: hramos fbshipit-source-id: 84f6b62a2734cc09d450e906b5866d4e9ce61124
26 lines
680 B
JavaScript
26 lines
680 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {TurboModule} from '../TurboModule/RCTExport';
|
|
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
|
|
|
export interface Spec extends TurboModule {
|
|
+getConstants: () => {||};
|
|
+vibrate: (pattern: number) => void;
|
|
|
|
// Android only
|
|
+vibrateByPattern: (pattern: Array<number>, repeat: number) => void;
|
|
+cancel: () => void;
|
|
}
|
|
|
|
export default (TurboModuleRegistry.getEnforcing<Spec>('Vibration'): Spec);
|