-
Notifications
You must be signed in to change notification settings - Fork 1
/
ConversationItem.js
49 lines (45 loc) · 1.18 KB
/
ConversationItem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from "react";
import { Text, View, StyleSheet } from "react-native";
export default function ConversationItem(props) {
const baloonStyle = [];
const containerStyle = [];
if (props.isUserMessage) {
baloonStyle.push(styles.userBaloon);
containerStyle.push(styles.userContainer);
} else {
baloonStyle.push(styles.botBaloon);
containerStyle.push(styles.botContainer);
}
return (
<View style={containerStyle}>
<Text style={baloonStyle}>{props.children}</Text>
</View>
)
}
const styles = StyleSheet.create({
botContainer: {
flexDirection: "row",
},
userContainer: {
flexDirection: "row-reverse",
},
botBaloon: {
fontSize: 16,
margin: 6,
padding: 8,
backgroundColor: "#8c8c8c",
color: "#fff",
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
borderBottomRightRadius: 10,
},
userBaloon: {
fontSize: 16,
padding: 6,
backgroundColor: "#1fd655",
color: "#fff",
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
borderBottomLeftRadius: 10,
},
});