mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
The types `Options` and `MultiOptions` as well as `OpenReturn` and `ShareSingleReturn` are taken directly from7535726eb4/index.jsand have only have been transformed to interfaces. The signature of the `shareSingle` call is missing `social` in the official repo as well, but from the native code it becomes apearent that it is required:7535726eb4/ios/RNShare.m (L85-L122)
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
// Type definitions for react-native-share 1.1
|
|
// Project: https://github.com/react-native-community/react-native-share#readme
|
|
// Definitions by: Mark Nelissen <https://github.com/marknelissen>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.1
|
|
|
|
declare namespace Share {
|
|
function open(options: Options | MultipleOptions): Promise<OpenReturn>;
|
|
function shareSingle(
|
|
options: Options & { social: SupportedSocialApps }
|
|
): Promise<ShareSingleReturn>;
|
|
}
|
|
|
|
export default Share;
|
|
|
|
interface OpenReturn {
|
|
app?: string;
|
|
dismissedAction?: boolean;
|
|
}
|
|
|
|
interface ShareSingleReturn {
|
|
message: string;
|
|
}
|
|
|
|
interface Options {
|
|
url: string;
|
|
urls?: string[];
|
|
type?: string;
|
|
message?: string;
|
|
title?: string;
|
|
subject?: string;
|
|
excludedActivityTypes?: string;
|
|
failOnCancel?: boolean;
|
|
showAppsToView?: boolean;
|
|
}
|
|
interface MultipleOptions {
|
|
url?: string;
|
|
urls: string[];
|
|
type?: string;
|
|
message?: string;
|
|
title?: string;
|
|
subject?: string;
|
|
excludedActivityTypes?: string;
|
|
failOnCancel?: boolean;
|
|
showAppsToView?: boolean;
|
|
}
|
|
|
|
type SupportedSocialApps =
|
|
| "facebook"
|
|
| "pagesmanager"
|
|
| "twitter"
|
|
| "whatsapp"
|
|
| "instagram"
|
|
| "googleplus"
|
|
| "email";
|