Skip to content

Commit

Permalink
feat: chatMessgaeId param으로 전달
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoniii20 committed Sep 7, 2024
1 parent f26ca64 commit d5b1c92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions screen/Chat/chatList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ const ChatList = () => {
: text;
};

const handleChatRoomClick = (chatRoomId) => {
const handleChatRoomClick = (chatRoomId, chatMessageId) => {
console.log(`채팅방으로 이동합니다... ID: ${chatRoomId}`);
console.log(`마지막 채팅 아이디... ID: ${chatMessageId}`);
navigation.navigate("ChatScreen", {
screen: "ChatRoom3",
params: { chatRoomId: chatRoomId },
params: { chatRoomId: chatRoomId, chatMessageId: chatMessageId },
});
};

Expand Down Expand Up @@ -140,7 +141,9 @@ const ChatList = () => {
<TouchableOpacity
activeOpacity={1}
style={styles.chatSection}
onPress={() => handleChatRoomClick(item.chatRoomId)}
onPress={() =>
handleChatRoomClick(item.chatRoomId, item.chatMessageId)
}
>
<View style={{ flexDirection: "row", gap: 13 }}>
<Image source={{ uri: item.profile }} style={styles.icon} />
Expand Down
2 changes: 1 addition & 1 deletion screen/Chat/chatRoom3.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ChatRoom3 = () => {
const route = useRoute();
const scrollViewRef = useRef();

const { chatRoomId, friendsId, friendsName } = route.params;
const { chatRoomId, friendsId, friendsName, chatMessageId } = route.params;

const profile = useStore((state) => state.profile);
const myId = profile.id;
Expand Down

0 comments on commit d5b1c92

Please sign in to comment.