Open History to see the last commit
1import { Platform, Share } from "react-native";
2import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
3
4interface PullRequestLink {
5 readonly url: string;
6 readonly title: string;
7}
8
9export function copyPullRequestLink(pr: PullRequestLink) {
10 copyTextWithHaptic(pr.url, { target: "pull request link" });
11}
12
13export function sharePullRequestLink(pr: PullRequestLink) {
14 // Android ignores `url`; iOS turns a `message` URL into plain text instead of a link preview.
15 Share.share(
16 Platform.OS === "ios" ? { url: pr.url, title: pr.title } : { message: pr.url, title: pr.title },
17 ).catch((cause: unknown) => console.error("Failed to share pull request link.", cause));
18}