Add 'copy post text' tool

This commit is contained in:
Paul Frazee 2022-12-05 15:03:42 -06:00
parent 73c84f6f64
commit bbe6bf8fc2
6 changed files with 32 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import {
ViewStyle,
} from 'react-native'
import {observer} from 'mobx-react-lite'
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'
@ -110,6 +111,10 @@ export const Post = observer(function Post({
.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(
() => {
@ -144,6 +149,7 @@ export const Post = observer(function Post({
authorDisplayName={item.author.displayName}
timestamp={item.indexedAt}
isAuthor={item.author.did === store.me.did}
onCopyPostText={onCopyPostText}
onDeletePost={onDeletePost}
/>
{replyHref !== '' && (