Skip to content

Commit

Permalink
fix: re-added default chat image
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Feb 1, 2024
1 parent 10be2f2 commit a8ee4c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions components/ChatMenu/ChatWindow/ChatItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Markdown from 'react-native-markdown-package'
import { useMMKVBoolean, useMMKVObject, useMMKVString } from 'react-native-mmkv'
import AnimatedEllipsis from 'rn-animated-ellipsis'
import SimpleMarkdown from 'simple-markdown'

import * as FS from 'expo-file-system'
import TTSMenu from './TTS'
// global chat property for editing

Expand All @@ -35,8 +35,8 @@ const ChatItem = ({ id }) => {
const [placeholderText, setPlaceholderText] = useState(message.mes)
const [editMode, setEditMode] = useState(false)
// figure this out
//const [imageExists, setImageExists] = useState(true)
/*useEffect(() => {
const [imageExists, setImageExists] = useState(true)
useEffect(() => {
FS.readAsStringAsync(
message.name === charName
? Characters.getImageDir(charName)
Expand All @@ -45,7 +45,7 @@ const ChatItem = ({ id }) => {
.then(() => setImageExists(true))
.catch(() => setImageExists(false))
setPlaceholderText(messages.at(id + 1).mes)
}, [message])*/
}, [message])

useEffect(() => {
setEditMode(false)
Expand Down Expand Up @@ -138,9 +138,11 @@ const ChatItem = ({ id }) => {
<Image
style={styles.avatar}
source={
message.name === charName
? { uri: Characters.getImageDir(charName) }
: { uri: Users.getImageDir(userName) }
imageExists
? message.name === charName
? { uri: Characters.getImageDir(charName) }
: { uri: Users.getImageDir(userName) }
: require('@assets/user.png')
}
/>
<Text style={styles.graytext}>#{id}</Text>
Expand Down Expand Up @@ -189,7 +191,10 @@ const ChatItem = ({ id }) => {
</View>

{!editMode ? (
message.name === charName && message.mes === '' && nowGenerating ? (
message.name === charName &&
message.mes === '' &&
nowGenerating &&
id === messages.length - 2 ? (
<View style={{ ...styles.messageTextContainer, padding: 5 }}>
<AnimatedEllipsis style={{ color: Color.White, fontSize: 20 }} />
</View>
Expand Down
2 changes: 1 addition & 1 deletion components/ChatMenu/ChatWindow/ChatWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ChatWindow = ({ messages }) => {
<FlatList
ref={flatListRef}
inverted
windowSize={2}
windowSize={3}
data={getItems()}
keyExtractor={(item) => item.key}
renderItem={({ item, index }) => (
Expand Down

0 comments on commit a8ee4c0

Please sign in to comment.