feat(mobile): edit text messages

This commit is contained in:
Arjun Patel
2026-05-26 10:10:49 -07:00
parent ec01ca77e4
commit e7fed5f037
4 changed files with 142 additions and 0 deletions
@@ -2,6 +2,7 @@ import { useEffect, useRef } from "react";
import { ScrollView, Text, View } from "react-native";
import type { Particle } from "@/api/types";
import { cn } from "@/lib/utils";
import { RelativeTimestamp } from "@/components/RelativeTimestamp";
import { useStreamSafeArea } from "./stream-safe-area";
type TextParticle = Extract<Particle, { type: "text" }>;
@@ -43,10 +44,19 @@ export function TextParticleView({
onProgress,
}: TextParticleViewProps) {
const content = particle.properties.content;
const editedAt = particle.properties.edited_at;
const durationS = computeReadDuration(content);
const elapsedRef = useRef(0);
const safe = useStreamSafeArea();
const editedLabel = editedAt ? (
<View className="mt-3 items-center">
<Text className="text-white/40 text-xs">
edited <RelativeTimestamp date={editedAt} />
</Text>
</View>
) : null;
// Reset when the particle changes.
useEffect(() => {
elapsedRef.current = 0;
@@ -85,6 +95,7 @@ export function TextParticleView({
>
{content}
</Text>
{editedLabel}
</View>
);
}
@@ -108,6 +119,7 @@ export function TextParticleView({
indicatorStyle="white"
>
<Text className="text-white text-lg leading-relaxed">{content}</Text>
{editedLabel}
</ScrollView>
</View>
);