react-native-gifted-chat 3.0.0-alpha.1 → 3.0.1

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/README.md +12 -30
  3. package/package.json +1 -1
  4. package/src/Actions.tsx +27 -18
  5. package/src/Composer.tsx +60 -80
  6. package/src/Constant.ts +0 -9
  7. package/src/GiftedChat/index.tsx +13 -38
  8. package/src/GiftedChat/types.ts +8 -6
  9. package/src/InputToolbar.tsx +6 -11
  10. package/src/MessageImage.tsx +94 -57
  11. package/src/{MessageContainer → MessagesContainer}/components/Item/index.tsx +21 -17
  12. package/src/{MessageContainer → MessagesContainer}/components/Item/types.ts +3 -2
  13. package/src/{MessageContainer → MessagesContainer}/index.tsx +16 -14
  14. package/src/{MessageContainer → MessagesContainer}/types.ts +4 -2
  15. package/src/Send.tsx +40 -22
  16. package/src/__tests__/DayAnimated.test.tsx +1 -1
  17. package/src/__tests__/{MessageContainer.test.tsx → MessagesContainer.test.tsx} +7 -7
  18. package/src/__tests__/__snapshots__/Actions.test.tsx.snap +31 -23
  19. package/src/__tests__/__snapshots__/Composer.test.tsx.snap +39 -30
  20. package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -2
  21. package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +112 -31
  22. package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +251 -0
  23. package/src/__tests__/__snapshots__/Send.test.tsx.snap +189 -49
  24. package/src/index.ts +1 -1
  25. package/src/styles.ts +5 -0
  26. package/src/types.ts +1 -1
  27. package/CHANGELOG_2.8.1_to_2.8.2-alpha.5.md +0 -374
  28. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/index.tsx +0 -0
  29. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/styles.ts +0 -0
  30. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/types.ts +0 -0
  31. /package/src/{MessageContainer → MessagesContainer}/styles.ts +0 -0
@@ -57,6 +57,257 @@ exports[`MessageImage should render <MessageImage /> and compare with snapshot
57
57
  }
58
58
  />
59
59
  </View>
60
+ <OverKeyboardView
61
+ visible={false}
62
+ >
63
+ <View
64
+ collapsable={false}
65
+ jestAnimatedProps={
66
+ {
67
+ "value": {},
68
+ }
69
+ }
70
+ jestAnimatedStyle={
71
+ {
72
+ "value": {
73
+ "borderRadius": 40,
74
+ "opacity": 0,
75
+ "transform": [
76
+ {
77
+ "scale": 0.9,
78
+ },
79
+ ],
80
+ },
81
+ }
82
+ }
83
+ jestInlineStyle={
84
+ [
85
+ {
86
+ "bottom": 0,
87
+ "left": 0,
88
+ "position": "absolute",
89
+ "right": 0,
90
+ "top": 0,
91
+ "zIndex": 1000,
92
+ },
93
+ ]
94
+ }
95
+ style={
96
+ [
97
+ {
98
+ "bottom": 0,
99
+ "left": 0,
100
+ "position": "absolute",
101
+ "right": 0,
102
+ "top": 0,
103
+ "zIndex": 1000,
104
+ },
105
+ {
106
+ "opacity": 0,
107
+ "transform": [
108
+ {
109
+ "scale": 0.9,
110
+ },
111
+ ],
112
+ },
113
+ {
114
+ "borderRadius": 40,
115
+ },
116
+ ]
117
+ }
118
+ >
119
+ <View
120
+ style={
121
+ {
122
+ "flex": 1,
123
+ }
124
+ }
125
+ >
126
+ <View
127
+ collapsable={false}
128
+ jestAnimatedProps={
129
+ {
130
+ "value": {},
131
+ }
132
+ }
133
+ jestAnimatedStyle={
134
+ {
135
+ "value": {
136
+ "borderRadius": 40,
137
+ },
138
+ }
139
+ }
140
+ jestInlineStyle={
141
+ [
142
+ {
143
+ "flex": 1,
144
+ },
145
+ {
146
+ "backgroundColor": "#000",
147
+ "overflow": "hidden",
148
+ },
149
+ {
150
+ "paddingBottom": 0,
151
+ "paddingTop": 0,
152
+ },
153
+ ]
154
+ }
155
+ style={
156
+ [
157
+ {
158
+ "flex": 1,
159
+ },
160
+ {
161
+ "backgroundColor": "#000",
162
+ "overflow": "hidden",
163
+ },
164
+ {
165
+ "borderRadius": 40,
166
+ },
167
+ {
168
+ "paddingBottom": 0,
169
+ "paddingTop": 0,
170
+ },
171
+ ]
172
+ }
173
+ >
174
+ <View
175
+ style={
176
+ {
177
+ "flexDirection": "row",
178
+ "justifyContent": "flex-end",
179
+ }
180
+ }
181
+ >
182
+ <View
183
+ accessibilityState={
184
+ {
185
+ "busy": undefined,
186
+ "checked": undefined,
187
+ "disabled": false,
188
+ "expanded": undefined,
189
+ "selected": undefined,
190
+ }
191
+ }
192
+ accessibilityValue={
193
+ {
194
+ "max": undefined,
195
+ "min": undefined,
196
+ "now": undefined,
197
+ "text": undefined,
198
+ }
199
+ }
200
+ accessible={true}
201
+ focusable={true}
202
+ onClick={[Function]}
203
+ onResponderGrant={[Function]}
204
+ onResponderMove={[Function]}
205
+ onResponderRelease={[Function]}
206
+ onResponderTerminate={[Function]}
207
+ onResponderTerminationRequest={[Function]}
208
+ onStartShouldSetResponder={[Function]}
209
+ />
210
+ </View>
211
+ <View
212
+ style={
213
+ [
214
+ {
215
+ "flex": 1,
216
+ },
217
+ {
218
+ "alignItems": "center",
219
+ "justifyContent": "center",
220
+ },
221
+ ]
222
+ }
223
+ >
224
+ <View
225
+ style={
226
+ {
227
+ "flex": 1,
228
+ }
229
+ }
230
+ >
231
+ <View
232
+ collapsable={false}
233
+ onLayout={[Function]}
234
+ style={
235
+ [
236
+ {
237
+ "alignItems": "center",
238
+ "flex": 1,
239
+ "justifyContent": "center",
240
+ "overflow": "hidden",
241
+ },
242
+ undefined,
243
+ ]
244
+ }
245
+ >
246
+ <View
247
+ collapsable={false}
248
+ jestAnimatedProps={
249
+ {
250
+ "value": {},
251
+ }
252
+ }
253
+ jestAnimatedStyle={
254
+ {
255
+ "value": {
256
+ "transform": [
257
+ {
258
+ "scale": 1,
259
+ },
260
+ {
261
+ "translateX": 0,
262
+ },
263
+ {
264
+ "translateY": 0,
265
+ },
266
+ ],
267
+ },
268
+ }
269
+ }
270
+ jestInlineStyle={
271
+ [
272
+ undefined,
273
+ ]
274
+ }
275
+ onLayout={[Function]}
276
+ style={
277
+ [
278
+ {
279
+ "transform": [
280
+ {
281
+ "scale": 1,
282
+ },
283
+ {
284
+ "translateX": 0,
285
+ },
286
+ {
287
+ "translateY": 0,
288
+ },
289
+ ],
290
+ },
291
+ undefined,
292
+ ]
293
+ }
294
+ >
295
+ <Image
296
+ resizeMode="contain"
297
+ source={
298
+ {
299
+ "uri": "url://to/image.png",
300
+ }
301
+ }
302
+ />
303
+ </View>
304
+ </View>
305
+ </View>
306
+ </View>
307
+ </View>
308
+ </View>
309
+ </View>
310
+ </OverKeyboardView>
60
311
  </View>
61
312
  `;
62
313
 
@@ -2,70 +2,210 @@
2
2
 
3
3
  exports[`Send should always render <Send /> and compare with snapshot 1`] = `
4
4
  <View
5
- accessibilityLabel="send"
6
- accessibilityRole="button"
7
- accessibilityState={
5
+ collapsable={false}
6
+ jestAnimatedProps={
8
7
  {
9
- "busy": undefined,
10
- "checked": undefined,
11
- "disabled": false,
12
- "expanded": undefined,
13
- "selected": undefined,
8
+ "value": {},
14
9
  }
15
10
  }
16
- accessibilityValue={
11
+ jestAnimatedStyle={
17
12
  {
18
- "max": undefined,
19
- "min": undefined,
20
- "now": undefined,
21
- "text": undefined,
13
+ "value": {
14
+ "opacity": 0,
15
+ },
22
16
  }
23
17
  }
24
- accessible={true}
25
- focusable={true}
26
- onClick={[Function]}
27
- onResponderGrant={[Function]}
28
- onResponderMove={[Function]}
29
- onResponderRelease={[Function]}
30
- onResponderTerminate={[Function]}
31
- onResponderTerminationRequest={[Function]}
32
- onStartShouldSetResponder={[Function]}
33
- testID="GC_SEND_TOUCHABLE"
34
- />
18
+ jestInlineStyle={
19
+ [
20
+ {
21
+ "justifyContent": "flex-end",
22
+ },
23
+ undefined,
24
+ ]
25
+ }
26
+ pointerEvents="auto"
27
+ style={
28
+ [
29
+ {
30
+ "justifyContent": "flex-end",
31
+ },
32
+ undefined,
33
+ {
34
+ "opacity": 0,
35
+ },
36
+ ]
37
+ }
38
+ >
39
+ <View
40
+ accessibilityLabel="send"
41
+ accessibilityRole="button"
42
+ accessibilityState={
43
+ {
44
+ "busy": undefined,
45
+ "checked": undefined,
46
+ "disabled": false,
47
+ "expanded": undefined,
48
+ "selected": undefined,
49
+ }
50
+ }
51
+ accessibilityValue={
52
+ {
53
+ "max": undefined,
54
+ "min": undefined,
55
+ "now": undefined,
56
+ "text": undefined,
57
+ }
58
+ }
59
+ accessible={true}
60
+ focusable={true}
61
+ onClick={[Function]}
62
+ onResponderGrant={[Function]}
63
+ onResponderMove={[Function]}
64
+ onResponderRelease={[Function]}
65
+ onResponderTerminate={[Function]}
66
+ onResponderTerminationRequest={[Function]}
67
+ onStartShouldSetResponder={[Function]}
68
+ testID="GC_SEND_TOUCHABLE"
69
+ />
70
+ </View>
35
71
  `;
36
72
 
37
- exports[`Send should not render <Send /> and compare with snapshot 1`] = `null`;
73
+ exports[`Send should not render <Send /> and compare with snapshot 1`] = `
74
+ <View
75
+ collapsable={false}
76
+ jestAnimatedProps={
77
+ {
78
+ "value": {},
79
+ }
80
+ }
81
+ jestAnimatedStyle={
82
+ {
83
+ "value": {
84
+ "opacity": 0,
85
+ },
86
+ }
87
+ }
88
+ jestInlineStyle={
89
+ [
90
+ {
91
+ "justifyContent": "flex-end",
92
+ },
93
+ undefined,
94
+ ]
95
+ }
96
+ pointerEvents="none"
97
+ style={
98
+ [
99
+ {
100
+ "justifyContent": "flex-end",
101
+ },
102
+ undefined,
103
+ {
104
+ "opacity": 0,
105
+ },
106
+ ]
107
+ }
108
+ >
109
+ <View
110
+ accessibilityLabel="send"
111
+ accessibilityRole="button"
112
+ accessibilityState={
113
+ {
114
+ "busy": undefined,
115
+ "checked": undefined,
116
+ "disabled": false,
117
+ "expanded": undefined,
118
+ "selected": undefined,
119
+ }
120
+ }
121
+ accessibilityValue={
122
+ {
123
+ "max": undefined,
124
+ "min": undefined,
125
+ "now": undefined,
126
+ "text": undefined,
127
+ }
128
+ }
129
+ accessible={true}
130
+ focusable={true}
131
+ onClick={[Function]}
132
+ onResponderGrant={[Function]}
133
+ onResponderMove={[Function]}
134
+ onResponderRelease={[Function]}
135
+ onResponderTerminate={[Function]}
136
+ onResponderTerminationRequest={[Function]}
137
+ onStartShouldSetResponder={[Function]}
138
+ testID="GC_SEND_TOUCHABLE"
139
+ />
140
+ </View>
141
+ `;
38
142
 
39
143
  exports[`Send should render <Send /> where there is input and compare with snapshot 1`] = `
40
144
  <View
41
- accessibilityLabel="send"
42
- accessibilityRole="button"
43
- accessibilityState={
145
+ collapsable={false}
146
+ jestAnimatedProps={
44
147
  {
45
- "busy": undefined,
46
- "checked": undefined,
47
- "disabled": false,
48
- "expanded": undefined,
49
- "selected": undefined,
148
+ "value": {},
50
149
  }
51
150
  }
52
- accessibilityValue={
151
+ jestAnimatedStyle={
53
152
  {
54
- "max": undefined,
55
- "min": undefined,
56
- "now": undefined,
57
- "text": undefined,
153
+ "value": {
154
+ "opacity": 0,
155
+ },
58
156
  }
59
157
  }
60
- accessible={true}
61
- focusable={true}
62
- onClick={[Function]}
63
- onResponderGrant={[Function]}
64
- onResponderMove={[Function]}
65
- onResponderRelease={[Function]}
66
- onResponderTerminate={[Function]}
67
- onResponderTerminationRequest={[Function]}
68
- onStartShouldSetResponder={[Function]}
69
- testID="GC_SEND_TOUCHABLE"
70
- />
158
+ jestInlineStyle={
159
+ [
160
+ {
161
+ "justifyContent": "flex-end",
162
+ },
163
+ undefined,
164
+ ]
165
+ }
166
+ pointerEvents="auto"
167
+ style={
168
+ [
169
+ {
170
+ "justifyContent": "flex-end",
171
+ },
172
+ undefined,
173
+ {
174
+ "opacity": 0,
175
+ },
176
+ ]
177
+ }
178
+ >
179
+ <View
180
+ accessibilityLabel="send"
181
+ accessibilityRole="button"
182
+ accessibilityState={
183
+ {
184
+ "busy": undefined,
185
+ "checked": undefined,
186
+ "disabled": false,
187
+ "expanded": undefined,
188
+ "selected": undefined,
189
+ }
190
+ }
191
+ accessibilityValue={
192
+ {
193
+ "max": undefined,
194
+ "min": undefined,
195
+ "now": undefined,
196
+ "text": undefined,
197
+ }
198
+ }
199
+ accessible={true}
200
+ focusable={true}
201
+ onClick={[Function]}
202
+ onResponderGrant={[Function]}
203
+ onResponderMove={[Function]}
204
+ onResponderRelease={[Function]}
205
+ onResponderTerminate={[Function]}
206
+ onResponderTerminationRequest={[Function]}
207
+ onStartShouldSetResponder={[Function]}
208
+ testID="GC_SEND_TOUCHABLE"
209
+ />
210
+ </View>
71
211
  `;
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ export { Day } from './Day'
14
14
  export { InputToolbar } from './InputToolbar'
15
15
  export { LoadEarlierMessages } from './LoadEarlierMessages'
16
16
  export { Message } from './Message'
17
- export { MessageContainer } from './MessageContainer'
17
+ export { MessagesContainer } from './MessagesContainer'
18
18
  export { Send } from './Send'
19
19
  export { Time } from './Time'
20
20
  export { GiftedAvatar } from './GiftedAvatar'
package/src/styles.ts CHANGED
@@ -9,3 +9,8 @@ export default StyleSheet.create({
9
9
  alignItems: 'center',
10
10
  },
11
11
  })
12
+
13
+ export function getColorSchemeStyle<T>(styles: T, baseName: string, colorScheme: string | null | undefined) {
14
+ const key = `${baseName}_${colorScheme}` as keyof T
15
+ return [styles[baseName as keyof T], styles[key]]
16
+ }
package/src/types.ts CHANGED
@@ -15,7 +15,7 @@ export { GiftedAvatarProps } from './GiftedAvatar'
15
15
  export { InputToolbarProps } from './InputToolbar'
16
16
  export { LoadEarlierMessagesProps } from './LoadEarlierMessages'
17
17
  export { MessageProps } from './Message'
18
- export { MessageContainerProps } from './MessageContainer'
18
+ export { MessagesContainerProps } from './MessagesContainer'
19
19
  export { MessageImageProps } from './MessageImage'
20
20
  export { MessageTextProps } from './MessageText'
21
21
  export { QuickRepliesProps } from './QuickReplies'