DefinitelyTyped/types/react-native-share/react-native-share-tests.ts
Ullrich Schäfer da2e09f603 [react-native-share] Syncing with flow types from repo (#29736)
The types `Options` and `MultiOptions` as well as `OpenReturn` and
`ShareSingleReturn` are taken directly from
7535726eb4/index.js
and 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)
2018-10-22 08:47:20 -07:00

43 lines
696 B
TypeScript

import Share from 'react-native-share';
// $ExpectType Promise<OpenReturn>
Share.open({
url: '',
message: '',
});
// $ExpectType Promise<OpenReturn>
Share.open({
title: '',
message: '',
urls: [],
});
// $ExpectType Promise<OpenReturn>
Share.open({
url: '',
type: '',
message: '',
title: '',
subject: '',
excludedActivityTypes: '',
showAppsToView: true,
});
// $ExpectType Promise<ShareSingleReturn>
Share.shareSingle({
url: '',
message: '',
social: 'facebook',
});
// $ExpectType Promise<ShareSingleReturn>
Share.shareSingle({
url: '',
type: '',
message: '',
title: '',
subject: '',
social: 'facebook',
});