about summary refs log tree commit diff
path: root/src/view/com/post-thread/PostThreadItem.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-12-05 15:03:42 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-12-05 15:03:42 -0600
commitbbe6bf8fc2f94b5f3aad03c7c356e2a34ae6f124 (patch)
tree971be0dd6871c116de69f0771e3c30f96fdf8ef5 /src/view/com/post-thread/PostThreadItem.tsx
parent73c84f6f64d70473da6f77675a00c7e222d4dfee (diff)
downloadvoidsky-bbe6bf8fc2f94b5f3aad03c7c356e2a34ae6f124.tar.zst
Add 'copy post text' tool
Diffstat (limited to 'src/view/com/post-thread/PostThreadItem.tsx')
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index fcfaba9d4..93cf4be37 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -1,6 +1,7 @@
 import React, {useMemo, useState} from 'react'
 import {observer} from 'mobx-react-lite'
 import {StyleSheet, Text, View} from 'react-native'
+import Clipboard from '@react-native-clipboard/clipboard'
 import {AtUri} from '../../../third-party/uri'
 import * as PostType from '../../../third-party/api/src/client/types/app/bsky/feed/post'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
@@ -75,6 +76,10 @@ export const PostThreadItem = observer(function PostThreadItem({
       .toggleUpvote()
       .catch(e => console.error('Failed to toggle upvote', record, e))
   }
+  const onCopyPostText = () => {
+    Clipboard.setString(record.text)
+    Toast.show('Copied to clipboard')
+  }
   const onDeletePost = () => {
     item.delete().then(
       () => {
@@ -130,6 +135,7 @@ export const PostThreadItem = observer(function PostThreadItem({
                   itemHref={itemHref}
                   itemTitle={itemTitle}
                   isAuthor={item.author.did === store.me.did}
+                  onCopyPostText={onCopyPostText}
                   onDeletePost={onDeletePost}>
                   <FontAwesomeIcon
                     icon="ellipsis-h"
@@ -257,6 +263,7 @@ export const PostThreadItem = observer(function PostThreadItem({
               authorDisplayName={item.author.displayName}
               timestamp={item.indexedAt}
               isAuthor={item.author.did === store.me.did}
+              onCopyPostText={onCopyPostText}
               onDeletePost={onDeletePost}
             />
             <View style={styles.postTextContainer}>