Skip to content

Commit

Permalink
[contacts] reuse RN ShareOptions type for shareContactAsync param…
Browse files Browse the repository at this point in the history
…eter (expo#26208)
  • Loading branch information
Simek authored Jan 3, 2024
1 parent 18abadd commit 01f9be2
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions docs/components/plugins/api/APISectionUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const hardcodedTypeLinks: Record<string, string> = {
Promise:
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise',
ReactNode: 'https://reactnative.dev/docs/react-node',
ShareOptions: 'https://reactnative.dev/docs/share#share',
SyntheticEvent: 'https://react.dev/reference/react-dom/components/common#react-event-object',
View: 'https://reactnative.dev/docs/view',
ViewProps: 'https://reactnative.dev/docs/view#props',
Expand Down
2 changes: 1 addition & 1 deletion docs/public/static/data/unversioned/expo-contacts.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/public/static/data/v50.0.0/expo-contacts.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/expo-contacts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### 💡 Others

- Reuse React Native `ShareOptions` type for `shareContactAsync` parameter typing. ([#26208](https://github.com/expo/expo/pull/26208) by [@Simek](https://github.com/Simek))

## 12.8.2 - 2023-12-19

_This version does not introduce any user-facing changes._
Expand Down
9 changes: 5 additions & 4 deletions packages/expo-contacts/build/Contacts.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-contacts/build/Contacts.d.ts.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/expo-contacts/build/Contacts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-contacts/build/Contacts.js.map

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions packages/expo-contacts/src/Contacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PermissionResponse, PermissionStatus, UnavailabilityError, uuid } from 'expo-modules-core';
import { Platform, Share } from 'react-native';
import { Platform, Share, type ShareOptions } from 'react-native';

import ExpoContacts from './ExpoContacts';

Expand Down Expand Up @@ -223,7 +223,7 @@ export type UrlAddress = {
*/
export type Image = {
/**
* A **local image URI**.
* A local image URI.
* > **Note**: If you have a remote URI, download it first using [`FileSystem.downloadAsync`](/versions/latest/sdk/filesystem/#filesystemdownloadasyncuri-fileuri-options).
*/
uri?: string;
Expand Down Expand Up @@ -387,7 +387,7 @@ export type ContactResponse = {
*/
hasNextPage: boolean;
/**
* This will be `true if there are previous contacts that weren't retrieved due to `pageOffset` limit.
* This will be `true` if there are previous contacts that weren't retrieved due to `pageOffset` limit.
*/
hasPreviousPage: boolean;
};
Expand Down Expand Up @@ -558,10 +558,11 @@ export async function isAvailableAsync(): Promise<boolean> {
return !!ExpoContacts.getContactsAsync;
}

// @docsMissing
export async function shareContactAsync(
contactId: string,
message: string,
shareOptions: object = {}
shareOptions: ShareOptions = {}
): Promise<any> {
if (Platform.OS === 'ios') {
const url = await writeContactToFileAsync({
Expand Down Expand Up @@ -811,7 +812,7 @@ export async function addExistingGroupToContainerAsync(
}

/**
* Create a group with a name, and add it to a container. If the container is undefined, the default container will be targeted.
* Create a group with a name, and add it to a container. If the container is `undefined`, the default container will be targeted.
* @param name Name of the new group.
* @param containerId The container you to add membership to.
* @return A promise that fulfills with ID of the new group.
Expand Down

0 comments on commit 01f9be2

Please sign in to comment.