diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-03-03 15:13:31 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-03 15:13:31 -0600 |
commit | a9920d963041e53be5c454da30f8109c2a145d19 (patch) | |
tree | b02b37ffb7ac972f8e34944749fd6cdc6b67b05d /src/view/com/post/Post.tsx | |
parent | c2bfa111ac1f2c5fed2dd1caa92106849b14eaec (diff) | |
download | voidsky-a9920d963041e53be5c454da30f8109c2a145d19.tar.zst |
Add translate link to post menu (#261)
* Add a google translate menu item to posts * Fix: make sure the dropdown menu is always visible (when low on the screen)
Diffstat (limited to 'src/view/com/post/Post.tsx')
-rw-r--r-- | src/view/com/post/Post.tsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index e8e6781f7..bf8dfed05 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -1,6 +1,7 @@ import React, {useState, useEffect} from 'react' import { ActivityIndicator, + Linking, StyleProp, StyleSheet, View, @@ -120,6 +121,11 @@ export const Post = observer(function Post({ Clipboard.setString(record.text) Toast.show('Copied to clipboard') } + const onOpenTranslate = () => { + Linking.openURL( + encodeURI(`https://translate.google.com/#auto|en|${record?.text || ''}`), + ) + } const onDeletePost = () => { item.delete().then( () => { @@ -214,6 +220,7 @@ export const Post = observer(function Post({ onPressToggleRepost={onPressToggleRepost} onPressToggleUpvote={onPressToggleUpvote} onCopyPostText={onCopyPostText} + onOpenTranslate={onOpenTranslate} onDeletePost={onDeletePost} /> </View> |