Skip to content

Commit 7de2fa8

Browse files
fix(image-gen): hide the placeholder glyph once the live preview renders
Device 2026-07-16: during 'Refining Image' the real preview thumbnail is shown, but the placeholder <Icon name="image"> stayed in the header and overlapped/duplicated the image. Gate it on !imagePreviewPath so it only shows in the pre-preview 'Generating Image' phase. Rendered test asserts the placeholder tracks imagePreviewPath; red-verified by removing the gate.
1 parent d3c0278 commit 7de2fa8

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* ImageProgressIndicator — the placeholder image glyph must disappear once the live preview renders.
3+
*
4+
* Device 2026-07-16: during "Refining Image" the real preview thumbnail is shown, but the placeholder
5+
* <Icon name="image"> stayed in the header and overlapped/duplicated the image. It's only meaningful in
6+
* the pre-preview "Generating Image" phase. Presentational component (styles/colors injected), so this
7+
* renders it directly with both states and asserts the placeholder's presence tracks imagePreviewPath.
8+
*/
9+
import React from 'react';
10+
import { render } from '@testing-library/react-native';
11+
import { ImageProgressIndicator } from '../../../src/screens/ChatScreen/ChatScreenComponents';
12+
13+
// The component reads styles/colors purely for presentation; return benign values for any key.
14+
const styles = new Proxy({}, { get: () => ({}) }) as never;
15+
const colors = new Proxy({}, { get: () => '#000000' }) as never;
16+
17+
const renderIndicator = (imagePreviewPath: string | null) =>
18+
render(
19+
<ImageProgressIndicator
20+
styles={styles}
21+
colors={colors}
22+
imagePreviewPath={imagePreviewPath}
23+
imageGenerationStatus="Refining"
24+
imageGenerationProgress={{ step: 7, totalSteps: 8 }}
25+
onStop={() => {}}
26+
/>,
27+
);
28+
29+
describe('ImageProgressIndicator placeholder glyph', () => {
30+
it('shows the placeholder image glyph BEFORE a preview exists (Generating Image)', () => {
31+
const { queryByTestId } = renderIndicator(null);
32+
expect(queryByTestId('image-progress-placeholder-icon')).not.toBeNull();
33+
});
34+
35+
it('HIDES the placeholder glyph once the live preview is showing (Refining Image)', () => {
36+
// The real thumbnail is up — the placeholder would just overlap it.
37+
const { queryByTestId } = renderIndicator('file:///tmp/preview.png');
38+
expect(queryByTestId('image-progress-placeholder-icon')).toBeNull();
39+
});
40+
});

src/screens/ChatScreen/ChatScreenComponents.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,14 @@ export const ImageProgressIndicator: React.FC<{
197197
)}
198198
<View style={styles.imageProgressContent}>
199199
<View style={styles.imageProgressHeader}>
200-
<View style={styles.imageProgressIconContainer}>
201-
<Icon name="image" size={18} color={colors.primary} />
202-
</View>
200+
{/* The placeholder image glyph is only meaningful BEFORE the live preview renders.
201+
Once the preview thumbnail is up (Refining Image), drop it — it just overlapped
202+
the real image (device 2026-07-16). */}
203+
{!imagePreviewPath && (
204+
<View style={styles.imageProgressIconContainer} testID="image-progress-placeholder-icon">
205+
<Icon name="image" size={18} color={colors.primary} />
206+
</View>
207+
)}
203208
<View style={styles.imageProgressInfo}>
204209
<Text style={styles.imageProgressTitle}>
205210
{imagePreviewPath ? 'Refining Image' : 'Generating Image'}

0 commit comments

Comments
 (0)