mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[react-native-share] adding filename type definition (#38646)
* chore(filename): adding filename type to rn-share * chore(test): implementing test to share-single with filename * feat(definitions-by): adding username to definitions on rn-share
This commit is contained in:
committed by
Ryan Cavanaugh
parent
4131598ed6
commit
1dc4eaa79e
20
types/react-native-share/index.d.ts
vendored
20
types/react-native-share/index.d.ts
vendored
@@ -2,14 +2,13 @@
|
||||
// Project: https://github.com/react-native-community/react-native-share#readme
|
||||
// Definitions by: Mark Nelissen <https://github.com/marknelissen>
|
||||
// pera <https://github.com/santiagofm>
|
||||
// MateusAndrade <https://github.com/MateusAndrade>
|
||||
// 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>;
|
||||
function shareSingle(options: Options & { social: SupportedSocialApps }): Promise<ShareSingleReturn>;
|
||||
}
|
||||
|
||||
export default Share;
|
||||
@@ -30,6 +29,7 @@ export interface Options {
|
||||
message?: string;
|
||||
title?: string;
|
||||
subject?: string;
|
||||
filename?: string;
|
||||
excludedActivityTypes?: string;
|
||||
failOnCancel?: boolean;
|
||||
showAppsToView?: boolean;
|
||||
@@ -47,10 +47,10 @@ export interface MultipleOptions {
|
||||
}
|
||||
|
||||
export type SupportedSocialApps =
|
||||
| "facebook"
|
||||
| "pagesmanager"
|
||||
| "twitter"
|
||||
| "whatsapp"
|
||||
| "instagram"
|
||||
| "googleplus"
|
||||
| "email";
|
||||
| 'facebook'
|
||||
| 'pagesmanager'
|
||||
| 'twitter'
|
||||
| 'whatsapp'
|
||||
| 'instagram'
|
||||
| 'googleplus'
|
||||
| 'email';
|
||||
|
||||
@@ -40,3 +40,14 @@ Share.shareSingle({
|
||||
subject: '',
|
||||
social: 'facebook',
|
||||
});
|
||||
|
||||
// $ExpectType Promise<ShareSingleReturn>
|
||||
Share.shareSingle({
|
||||
url: '',
|
||||
type: '',
|
||||
message: '',
|
||||
title: '',
|
||||
subject: '',
|
||||
filename: 'test',
|
||||
social: 'facebook',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user