| .. | .. |
|---|
| 1 | 1 | import React, { useCallback, useState } from "react"; |
|---|
| 2 | | -import { Pressable, Text, View } from "react-native"; |
|---|
| 2 | +import { Image, Pressable, Text, View } from "react-native"; |
|---|
| 3 | 3 | import { Message } from "../../types"; |
|---|
| 4 | 4 | import { playAudio, stopPlayback } from "../../services/audio"; |
|---|
| 5 | 5 | |
|---|
| .. | .. |
|---|
| 57 | 57 | : "bg-pai-surface rounded-tl-sm" |
|---|
| 58 | 58 | }`} |
|---|
| 59 | 59 | > |
|---|
| 60 | | - {message.type === "voice" ? ( |
|---|
| 60 | + {message.type === "image" && message.imageBase64 ? ( |
|---|
| 61 | + /* Image message */ |
|---|
| 62 | + <View> |
|---|
| 63 | + <Image |
|---|
| 64 | + source={{ uri: `data:image/png;base64,${message.imageBase64}` }} |
|---|
| 65 | + style={{ |
|---|
| 66 | + width: 260, |
|---|
| 67 | + height: 180, |
|---|
| 68 | + borderRadius: 10, |
|---|
| 69 | + backgroundColor: "#14141F", |
|---|
| 70 | + }} |
|---|
| 71 | + resizeMode="contain" |
|---|
| 72 | + /> |
|---|
| 73 | + {message.content ? ( |
|---|
| 74 | + <Text |
|---|
| 75 | + style={{ |
|---|
| 76 | + color: isUser ? "#FFF" : "#9898B0", |
|---|
| 77 | + fontSize: 12, |
|---|
| 78 | + marginTop: 4, |
|---|
| 79 | + }} |
|---|
| 80 | + > |
|---|
| 81 | + {message.content} |
|---|
| 82 | + </Text> |
|---|
| 83 | + ) : null} |
|---|
| 84 | + </View> |
|---|
| 85 | + ) : message.type === "voice" ? ( |
|---|
| 61 | 86 | <Pressable |
|---|
| 62 | 87 | onPress={handleVoicePress} |
|---|
| 63 | 88 | className="flex-row items-center gap-3" |
|---|