mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
99899d008f
Summary: Part of #24875, adds a spec for linking. ## Changelog [General] [Added] - TM Spec for Linking Pull Request resolved: https://github.com/facebook/react-native/pull/24877 Differential Revision: D15374328 Pulled By: fkgozali fbshipit-source-id: 4b86a75d58d275c0ddc864b4f3f1ec489b0b408b
38 lines
1019 B
JavaScript
38 lines
1019 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
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {TurboModule} from 'RCTExport';
|
|
import * as TurboModuleRegistry from 'TurboModuleRegistry';
|
|
import Platform from 'Platform';
|
|
|
|
export interface Spec extends TurboModule {
|
|
// Common interface
|
|
+getInitialURL: () => Promise<string>;
|
|
+canOpenURL: (url: string) => Promise<boolean>;
|
|
+openURL: (url: string) => Promise<void>;
|
|
+openSettings: () => Promise<void>;
|
|
|
|
// Android only
|
|
+sendIntent: (
|
|
action: string,
|
|
extras: ?Array<{key: string, value: string | number | boolean}>,
|
|
) => Promise<void>;
|
|
|
|
// Events
|
|
+addListener: (eventName: string) => void;
|
|
+removeListeners: (count: number) => void;
|
|
}
|
|
|
|
export default (Platform.OS === 'ios'
|
|
? TurboModuleRegistry.getEnforcing<Spec>('LinkingManager')
|
|
: TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid'));
|