mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Align own user messages to the right and other user messages to the left
This commit is contained in:
parent
0c9f53b84d
commit
8e5e0546df
1 changed files with 7 additions and 1 deletions
|
@ -34,9 +34,12 @@ import { useToast } from "react-native-toast-notifications";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer";
|
import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { RootState } from "../../features/redux/Store/Store";
|
||||||
|
|
||||||
export default function ConversationPage() {
|
export default function ConversationPage() {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
const user = useSelector((state: RootState) => state.user);
|
||||||
// Student Status
|
// Student Status
|
||||||
const [student_status, setStudentStatus] = useState<StudentStatusType>();
|
const [student_status, setStudentStatus] = useState<StudentStatusType>();
|
||||||
const StudentStatusQuery = useQuery({
|
const StudentStatusQuery = useQuery({
|
||||||
|
@ -248,7 +251,10 @@ export default function ConversationPage() {
|
||||||
key={message.id}
|
key={message.id}
|
||||||
style={{
|
style={{
|
||||||
...styles.message_contentContainer,
|
...styles.message_contentContainer,
|
||||||
alignItems: index % 2 == 0 ? "flex-end" : "flex-start",
|
alignItems:
|
||||||
|
message.user === user.user.username
|
||||||
|
? "flex-end"
|
||||||
|
: "flex-start",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={styles.flex_row}>
|
<View style={styles.flex_row}>
|
||||||
|
|
Loading…
Reference in a new issue