react-native-gifted-chat 3.2.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +450 -156
- package/package.json +9 -8
- package/src/Bubble/index.tsx +34 -2
- package/src/Bubble/types.ts +17 -4
- package/src/Composer.tsx +1 -2
- package/src/Day/index.tsx +2 -2
- package/src/Day/types.ts +3 -2
- package/src/GiftedAvatar.tsx +1 -1
- package/src/GiftedChat/index.tsx +109 -23
- package/src/GiftedChat/types.ts +9 -3
- package/src/InputToolbar.tsx +62 -8
- package/src/Message/index.tsx +181 -21
- package/src/Message/types.ts +4 -0
- package/src/MessageReply.tsx +160 -0
- package/src/MessageText.tsx +2 -2
- package/src/MessagesContainer/components/DayAnimated/index.tsx +5 -1
- package/src/MessagesContainer/components/Item/index.tsx +82 -47
- package/src/MessagesContainer/index.tsx +30 -19
- package/src/MessagesContainer/styles.ts +2 -0
- package/src/MessagesContainer/types.ts +30 -3
- package/src/Models.ts +3 -0
- package/src/Reply/index.ts +1 -0
- package/src/Reply/types.ts +80 -0
- package/src/ReplyPreview.tsx +132 -0
- package/src/Send.tsx +8 -3
- package/src/SystemMessage.tsx +22 -16
- package/src/__tests__/MessageReply.test.tsx +54 -0
- package/src/__tests__/ReplyPreview.test.tsx +41 -0
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +69 -42
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +11 -15
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +24 -18
- package/src/__tests__/__snapshots__/MessageReply.test.tsx.snap +181 -0
- package/src/__tests__/__snapshots__/ReplyPreview.test.tsx.snap +403 -0
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +3 -0
- package/src/__tests__/__snapshots__/SystemMessage.test.tsx.snap +36 -25
- package/src/components/MessageReply.tsx +156 -0
- package/src/components/ReplyPreview.tsx +230 -0
- package/src/index.ts +6 -1
- package/src/types.ts +17 -16
- package/src/utils.ts +11 -3
- package/CHANGELOG.md +0 -364
- package/src/reanimatedCompat.ts +0 -27
|
@@ -20,27 +20,36 @@ exports[`should render <GiftedChat/> and compare with snapshot 1`] = `
|
|
|
20
20
|
}
|
|
21
21
|
>
|
|
22
22
|
<View
|
|
23
|
-
|
|
23
|
+
onLayout={[Function]}
|
|
24
24
|
style={
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
"flex": 1,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"overflow": "hidden",
|
|
31
|
+
},
|
|
32
|
+
]
|
|
28
33
|
}
|
|
34
|
+
testID="GC_WRAPPER"
|
|
29
35
|
>
|
|
30
36
|
<View
|
|
31
|
-
|
|
37
|
+
behavior="padding"
|
|
38
|
+
keyboardVerticalOffset={50}
|
|
32
39
|
style={
|
|
33
|
-
|
|
40
|
+
{
|
|
41
|
+
"flex": 1,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
<View
|
|
46
|
+
style={
|
|
34
47
|
{
|
|
35
48
|
"flex": 1,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
testID="GC_WRAPPER"
|
|
43
|
-
/>
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
44
53
|
</View>
|
|
45
54
|
</View>
|
|
46
55
|
</KeyboardProvider>
|
|
@@ -67,27 +76,36 @@ exports[`should render <GiftedChat/> with dark colorScheme and compare with snap
|
|
|
67
76
|
}
|
|
68
77
|
>
|
|
69
78
|
<View
|
|
70
|
-
|
|
79
|
+
onLayout={[Function]}
|
|
71
80
|
style={
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
[
|
|
82
|
+
{
|
|
83
|
+
"flex": 1,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"overflow": "hidden",
|
|
87
|
+
},
|
|
88
|
+
]
|
|
75
89
|
}
|
|
90
|
+
testID="GC_WRAPPER"
|
|
76
91
|
>
|
|
77
92
|
<View
|
|
78
|
-
|
|
93
|
+
behavior="padding"
|
|
94
|
+
keyboardVerticalOffset={50}
|
|
79
95
|
style={
|
|
80
|
-
|
|
96
|
+
{
|
|
97
|
+
"flex": 1,
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
<View
|
|
102
|
+
style={
|
|
81
103
|
{
|
|
82
104
|
"flex": 1,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
testID="GC_WRAPPER"
|
|
90
|
-
/>
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/>
|
|
108
|
+
</View>
|
|
91
109
|
</View>
|
|
92
110
|
</View>
|
|
93
111
|
</KeyboardProvider>
|
|
@@ -114,27 +132,36 @@ exports[`should render <GiftedChat/> with light colorScheme and compare with sna
|
|
|
114
132
|
}
|
|
115
133
|
>
|
|
116
134
|
<View
|
|
117
|
-
|
|
135
|
+
onLayout={[Function]}
|
|
118
136
|
style={
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"flex": 1,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"overflow": "hidden",
|
|
143
|
+
},
|
|
144
|
+
]
|
|
122
145
|
}
|
|
146
|
+
testID="GC_WRAPPER"
|
|
123
147
|
>
|
|
124
148
|
<View
|
|
125
|
-
|
|
149
|
+
behavior="padding"
|
|
150
|
+
keyboardVerticalOffset={50}
|
|
126
151
|
style={
|
|
127
|
-
|
|
152
|
+
{
|
|
153
|
+
"flex": 1,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
<View
|
|
158
|
+
style={
|
|
128
159
|
{
|
|
129
160
|
"flex": 1,
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
testID="GC_WRAPPER"
|
|
137
|
-
/>
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
</View>
|
|
138
165
|
</View>
|
|
139
166
|
</View>
|
|
140
167
|
</KeyboardProvider>
|
|
@@ -4,14 +4,12 @@ exports[`should render <InputToolbar /> and compare with snapshot 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
undefined,
|
|
14
|
-
],
|
|
7
|
+
{
|
|
8
|
+
"backgroundColor": "#fff",
|
|
9
|
+
"borderTopColor": "#b2b2b2",
|
|
10
|
+
"borderTopWidth": 0.5,
|
|
11
|
+
},
|
|
12
|
+
false,
|
|
15
13
|
undefined,
|
|
16
14
|
]
|
|
17
15
|
}
|
|
@@ -19,13 +17,10 @@ exports[`should render <InputToolbar /> and compare with snapshot 1`] = `
|
|
|
19
17
|
<View
|
|
20
18
|
style={
|
|
21
19
|
[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
undefined,
|
|
28
|
-
],
|
|
20
|
+
{
|
|
21
|
+
"alignItems": "flex-end",
|
|
22
|
+
"flexDirection": "row",
|
|
23
|
+
},
|
|
29
24
|
undefined,
|
|
30
25
|
]
|
|
31
26
|
}
|
|
@@ -99,6 +94,7 @@ exports[`should render <InputToolbar /> and compare with snapshot 1`] = `
|
|
|
99
94
|
undefined,
|
|
100
95
|
]
|
|
101
96
|
}
|
|
97
|
+
nativeID="0"
|
|
102
98
|
pointerEvents="none"
|
|
103
99
|
style={
|
|
104
100
|
[
|
|
@@ -65,6 +65,7 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
|
|
|
65
65
|
},
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
|
+
nativeID="0"
|
|
68
69
|
style={
|
|
69
70
|
[
|
|
70
71
|
{
|
|
@@ -125,6 +126,7 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
|
|
|
125
126
|
},
|
|
126
127
|
]
|
|
127
128
|
}
|
|
129
|
+
nativeID="1"
|
|
128
130
|
style={
|
|
129
131
|
[
|
|
130
132
|
{
|
|
@@ -196,24 +198,27 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
|
|
|
196
198
|
>
|
|
197
199
|
<View
|
|
198
200
|
style={
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
[
|
|
202
|
+
{
|
|
203
|
+
"alignItems": "center",
|
|
204
|
+
"flex": 1,
|
|
205
|
+
"justifyContent": "center",
|
|
206
|
+
"overflow": "hidden",
|
|
207
|
+
},
|
|
208
|
+
undefined,
|
|
209
|
+
]
|
|
202
210
|
}
|
|
203
211
|
>
|
|
204
212
|
<View
|
|
205
213
|
collapsable={false}
|
|
206
214
|
onLayout={[Function]}
|
|
207
215
|
style={
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
},
|
|
215
|
-
undefined,
|
|
216
|
-
]
|
|
216
|
+
{
|
|
217
|
+
"alignItems": "center",
|
|
218
|
+
"flex": 1,
|
|
219
|
+
"justifyContent": "center",
|
|
220
|
+
"overflow": "hidden",
|
|
221
|
+
}
|
|
217
222
|
}
|
|
218
223
|
>
|
|
219
224
|
<View
|
|
@@ -227,15 +232,15 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
|
|
|
227
232
|
{
|
|
228
233
|
"value": {
|
|
229
234
|
"transform": [
|
|
230
|
-
{
|
|
231
|
-
"scale": 1,
|
|
232
|
-
},
|
|
233
235
|
{
|
|
234
236
|
"translateX": 0,
|
|
235
237
|
},
|
|
236
238
|
{
|
|
237
239
|
"translateY": 0,
|
|
238
240
|
},
|
|
241
|
+
{
|
|
242
|
+
"scale": 1,
|
|
243
|
+
},
|
|
239
244
|
],
|
|
240
245
|
},
|
|
241
246
|
}
|
|
@@ -245,20 +250,21 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
|
|
|
245
250
|
undefined,
|
|
246
251
|
]
|
|
247
252
|
}
|
|
253
|
+
nativeID="2"
|
|
248
254
|
onLayout={[Function]}
|
|
249
255
|
style={
|
|
250
256
|
[
|
|
251
257
|
{
|
|
252
258
|
"transform": [
|
|
253
|
-
{
|
|
254
|
-
"scale": 1,
|
|
255
|
-
},
|
|
256
259
|
{
|
|
257
260
|
"translateX": 0,
|
|
258
261
|
},
|
|
259
262
|
{
|
|
260
263
|
"translateY": 0,
|
|
261
264
|
},
|
|
265
|
+
{
|
|
266
|
+
"scale": 1,
|
|
267
|
+
},
|
|
262
268
|
],
|
|
263
269
|
},
|
|
264
270
|
undefined,
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`should render <MessageReply /> and compare with snapshot 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
accessibilityState={
|
|
6
|
+
{
|
|
7
|
+
"busy": undefined,
|
|
8
|
+
"checked": undefined,
|
|
9
|
+
"disabled": undefined,
|
|
10
|
+
"expanded": undefined,
|
|
11
|
+
"selected": undefined,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
accessibilityValue={
|
|
15
|
+
{
|
|
16
|
+
"max": undefined,
|
|
17
|
+
"min": undefined,
|
|
18
|
+
"now": undefined,
|
|
19
|
+
"text": undefined,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
accessible={true}
|
|
23
|
+
collapsable={false}
|
|
24
|
+
focusable={true}
|
|
25
|
+
onBlur={[Function]}
|
|
26
|
+
onClick={[Function]}
|
|
27
|
+
onFocus={[Function]}
|
|
28
|
+
onResponderGrant={[Function]}
|
|
29
|
+
onResponderMove={[Function]}
|
|
30
|
+
onResponderRelease={[Function]}
|
|
31
|
+
onResponderTerminate={[Function]}
|
|
32
|
+
onResponderTerminationRequest={[Function]}
|
|
33
|
+
onStartShouldSetResponder={[Function]}
|
|
34
|
+
>
|
|
35
|
+
<View
|
|
36
|
+
style={
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
"borderRadius": 8,
|
|
40
|
+
"marginBottom": 4,
|
|
41
|
+
"paddingHorizontal": 10,
|
|
42
|
+
"paddingVertical": 6,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"backgroundColor": "rgba(0, 0, 0, 0.06)",
|
|
46
|
+
"borderLeftColor": "#0084ff",
|
|
47
|
+
"borderLeftWidth": 3,
|
|
48
|
+
},
|
|
49
|
+
undefined,
|
|
50
|
+
undefined,
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
<Text
|
|
55
|
+
numberOfLines={1}
|
|
56
|
+
style={
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"fontWeight": "600",
|
|
60
|
+
"marginBottom": 2,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"color": "#0084ff",
|
|
64
|
+
},
|
|
65
|
+
undefined,
|
|
66
|
+
undefined,
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
>
|
|
70
|
+
John Doe
|
|
71
|
+
</Text>
|
|
72
|
+
<Text
|
|
73
|
+
numberOfLines={2}
|
|
74
|
+
style={
|
|
75
|
+
[
|
|
76
|
+
{
|
|
77
|
+
"fontSize": 13,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"color": "#333",
|
|
81
|
+
},
|
|
82
|
+
undefined,
|
|
83
|
+
undefined,
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
Original message text
|
|
88
|
+
</Text>
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
exports[`should render <MessageReply /> on right position and compare with snapshot 1`] = `
|
|
94
|
+
<View
|
|
95
|
+
accessibilityState={
|
|
96
|
+
{
|
|
97
|
+
"busy": undefined,
|
|
98
|
+
"checked": undefined,
|
|
99
|
+
"disabled": undefined,
|
|
100
|
+
"expanded": undefined,
|
|
101
|
+
"selected": undefined,
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
accessibilityValue={
|
|
105
|
+
{
|
|
106
|
+
"max": undefined,
|
|
107
|
+
"min": undefined,
|
|
108
|
+
"now": undefined,
|
|
109
|
+
"text": undefined,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
accessible={true}
|
|
113
|
+
collapsable={false}
|
|
114
|
+
focusable={true}
|
|
115
|
+
onBlur={[Function]}
|
|
116
|
+
onClick={[Function]}
|
|
117
|
+
onFocus={[Function]}
|
|
118
|
+
onResponderGrant={[Function]}
|
|
119
|
+
onResponderMove={[Function]}
|
|
120
|
+
onResponderRelease={[Function]}
|
|
121
|
+
onResponderTerminate={[Function]}
|
|
122
|
+
onResponderTerminationRequest={[Function]}
|
|
123
|
+
onStartShouldSetResponder={[Function]}
|
|
124
|
+
>
|
|
125
|
+
<View
|
|
126
|
+
style={
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
"borderRadius": 8,
|
|
130
|
+
"marginBottom": 4,
|
|
131
|
+
"paddingHorizontal": 10,
|
|
132
|
+
"paddingVertical": 6,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"backgroundColor": "rgba(255, 255, 255, 0.15)",
|
|
136
|
+
"borderLeftColor": "rgba(255, 255, 255, 0.6)",
|
|
137
|
+
"borderLeftWidth": 3,
|
|
138
|
+
},
|
|
139
|
+
undefined,
|
|
140
|
+
undefined,
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
>
|
|
144
|
+
<Text
|
|
145
|
+
numberOfLines={1}
|
|
146
|
+
style={
|
|
147
|
+
[
|
|
148
|
+
{
|
|
149
|
+
"fontWeight": "600",
|
|
150
|
+
"marginBottom": 2,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"color": "rgba(255, 255, 255, 0.9)",
|
|
154
|
+
},
|
|
155
|
+
undefined,
|
|
156
|
+
undefined,
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
>
|
|
160
|
+
You
|
|
161
|
+
</Text>
|
|
162
|
+
<Text
|
|
163
|
+
numberOfLines={2}
|
|
164
|
+
style={
|
|
165
|
+
[
|
|
166
|
+
{
|
|
167
|
+
"fontSize": 13,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"color": "rgba(255, 255, 255, 0.9)",
|
|
171
|
+
},
|
|
172
|
+
undefined,
|
|
173
|
+
undefined,
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
>
|
|
177
|
+
Original message text
|
|
178
|
+
</Text>
|
|
179
|
+
</View>
|
|
180
|
+
</View>
|
|
181
|
+
`;
|