Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): show when highlighted code has been copied #48276

Openmanwithshit(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48276/headopened View on GitHub

Showing 1 changed file with 9 additions and 5 deletions.

x
0 of 1 viewed, 1 left
9 additions and 5 deletionsapps/mobile/src/native/HighlightedCodeBlock.tsxModified
View file
@@ -4,9 +4,11 @@
import type { MarkdownStyle } from "react-native-enriched-markdown";
​
import { Menu } from "../components/ui/Menu";
+import { CopyTextButton } from "../features/threads/CopyTextButton";
import { useMarkdownCodeHighlight } from "../features/threads/markdownCodeHighlightState";
import { copyTextWithHaptic } from "../lib/copyTextWithHaptic";
import { type HighlightScheme, withTokenStarts } from "../lib/highlights";
+import { themeColorWithAlpha } from "../lib/mobileTheme";
import { CodeBlockFrame, CodeBlockHeaderButton } from "./CodeBlockFrame";
import { fencedCodeMarkdown } from "./codeBlockMarkdown";
import type { NativeMarkdownTextStyle } from "./SelectableMarkdownText.types";
@@ -114,11 +116,13 @@
active={wrapped}
onPress={() => setWrapped((value) => !value)}
- <CodeBlockHeaderButton
- icon="doc.on.doc"
- label={gt`Copy code`}
- textStyle={textStyle}
- onPress={() => copyTextWithHaptic(code)}
+ <CopyTextButton
+ accessibilityLabel={gt`Copy code`}
+ text={code}
+ buttonSize={18}
+ iconSize={14}
+ tintColor={themeColorWithAlpha(textStyle.codeColor, 0.6)}
+ copiedTintColor={textStyle.codeColor}