[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:
Mateus Andrade
2019-10-03 18:22:54 -03:00
committed by Ryan Cavanaugh
parent 4131598ed6
commit 1dc4eaa79e
2 changed files with 21 additions and 10 deletions

View File

@@ -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';

View File

@@ -40,3 +40,14 @@ Share.shareSingle({
subject: '',
social: 'facebook',
});
// $ExpectType Promise<ShareSingleReturn>
Share.shareSingle({
url: '',
type: '',
message: '',
title: '',
subject: '',
filename: 'test',
social: 'facebook',
});