Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(chat): show Codex generated images in the thread #6441

Closedsambhavthakkar(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/6441/headopened View on GitHub

Showing 20 changed files with 42 additions and 1 deletion (loading 17).

x
0 of 20 viewed, 20 left
31 additions and 1 deletionapps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.ios.tsxModified
View file
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
import { Image, ScrollView, Text, useColorScheme, View } from "react-native";
import type { MarkdownNode } from "react-native-nitro-markdown/headless";
​
@@ -13,9 +13,14 @@
import type {
MarkdownCodeHighlighter,
MarkdownHighlightedToken,
+ MarkdownImageRenderProps,
NativeMarkdownTextStyle,
} from "./SelectableMarkdownText.types";
​
+const MarkdownImageRenderContext = createContext<
+ ((props: MarkdownImageRenderProps) => ReactNode) | undefined
+>(undefined);
+​
type HighlightedCode = ReadonlyArray<ReadonlyArray<MarkdownHighlightedToken>>;
​
const highlightedCodeCache = new Map<string, HighlightedCode>();
@@ -380,6 +385,10 @@
readonly onLinkPress?: (href: string) => void;
}) {
const href = props.node.href;
+ const renderImage = useContext(MarkdownImageRenderContext);
+ if (href && renderImage) {
+ return <>{renderImage({ href, alt: props.node.alt ?? props.node.title })}</>;
+ }