Skip to content

Commit

Permalink
refactor: change type to interface and add example meta to example apps
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinHeidenis committed Apr 8, 2024
1 parent b885ff3 commit cb1e811
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/basic/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function App() {
</Text>
{!!shareIntent.text && <Text style={styles.gap}>{shareIntent.text}</Text>}
{!!shareIntent.meta?.title && (
<Text>{JSON.stringify(shareIntent.meta)}</Text>
<Text style={styles.gap}>{JSON.stringify(shareIntent.meta)}</Text>
)}
{shareIntent?.files?.map((file) => (
<Image
Expand Down
3 changes: 3 additions & 0 deletions example/expo-router/app/shareintent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default function ShareIntent() {
</Text>
)}
{!!shareIntent.text && <Text style={styles.gap}>{shareIntent.text}</Text>}
{!!shareIntent.meta?.title && (
<Text style={styles.gap}>{JSON.stringify(shareIntent.meta)}</Text>
)}
{shareIntent?.files?.map((file) => (
<Image
key={file.path}
Expand Down
3 changes: 3 additions & 0 deletions example/react-navigation/app/ShareIntentScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default function ShareIntentScreen({ navigation }: Props) {
{hasShareIntent ? "SHARE INTENT FOUND !" : "NO SHARE INTENT DETECTED"}
</Text>
{!!shareIntent.text && <Text style={styles.gap}>{shareIntent.text}</Text>}
{!!shareIntent.meta?.title && (
<Text style={styles.gap}>{JSON.stringify(shareIntent.meta)}</Text>
)}
{shareIntent?.files?.map((file) => (
<Image
key={file.path}
Expand Down
7 changes: 3 additions & 4 deletions src/ExpoShareIntentModule.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ export interface ShareIntentFile {
size: number | null;
}

export type BaseNativeShareIntent = {
interface BaseNativeShareIntent {
text?: string;
files?: ShareIntentFile[];
type: "file" | "text";
meta?: ShareIntentMeta;
};
}

export type IosShareIntent = BaseNativeShareIntent & {
files?: IosShareIntentFile[];
Expand All @@ -54,6 +52,7 @@ export interface IosShareIntentFile {

export type AndroidShareIntent = BaseNativeShareIntent & {
files?: AndroidShareIntentFile[];
type: "file" | "text";
};

export interface AndroidShareIntentFile {
Expand Down

0 comments on commit cb1e811

Please sign in to comment.