fix: unified Share Action types (#38351)

Summary:
This pull request simplifies the type and fixes a TypeScript object destructuring problem by combining the ShareSharedAction and ShareDismissedAction types into a single ShareAction type. Enabling proper access to the activityType property without TypeScript errors.

## Changelog:
[INTERNAL] [FIXED] -  Unified ShareSharedAction and ShareDismissedAction into ShareAction. Resolved TypeScript issue with object destructuring.

Pull Request resolved: https://github.com/facebook/react-native/pull/38351

Test Plan:
With the current typing:
![image](https://github.com/facebook/react-native/assets/7197169/40b43c40-ed6c-4b1a-8f43-0bb853920e20)

With the proposed solution:
![image](https://github.com/facebook/react-native/assets/7197169/af9e601b-780c-4c69-9a8c-11771a125a0c)

Reviewed By: NickGerleman

Differential Revision: D47527426

Pulled By: philIip

fbshipit-source-id: 9830cd993596bbac2dc07d9f37ca20b35f582156
This commit is contained in:
Everaldo Junior
2023-07-20 16:04:58 -07:00
committed by Facebook GitHub Bot
parent 2669f8c384
commit caa8dbf0e9
2 changed files with 4 additions and 11 deletions
+3 -9
View File
@@ -27,17 +27,11 @@ export type ShareOptions = {
anchor?: number | undefined;
};
export type ShareSharedAction = {
action: 'sharedAction';
activityType?: string | undefined;
export type ShareAction = {
action: 'sharedAction' | 'dismissedAction';
activityType?: string | null | undefined;
};
export type ShareDismissedAction = {
action: 'dismissedAction';
};
export type ShareAction = ShareSharedAction | ShareDismissedAction;
export interface ShareStatic {
/**
* Open a dialog to share text content.
@@ -84,8 +84,7 @@ import {
SectionListProps,
SectionListRenderItemInfo,
Share,
ShareDismissedAction,
ShareSharedAction,
ShareAction,
StatusBar,
StyleProp,
StyleSheet,