react-native-gifted-chat 3.0.0-alpha.0 → 3.0.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/CHANGELOG.md +295 -0
- package/README.md +71 -95
- package/package.json +2 -2
- package/src/Actions.tsx +27 -18
- package/src/Composer.tsx +21 -84
- package/src/Constant.ts +0 -9
- package/src/GiftedChat/index.tsx +52 -163
- package/src/GiftedChat/types.ts +11 -12
- package/src/InputToolbar.tsx +6 -11
- package/src/MessageImage.tsx +135 -65
- package/src/{MessageContainer → MessagesContainer}/components/Item/index.tsx +21 -17
- package/src/{MessageContainer → MessagesContainer}/components/Item/types.ts +3 -2
- package/src/{MessageContainer → MessagesContainer}/index.tsx +18 -14
- package/src/{MessageContainer → MessagesContainer}/styles.ts +12 -5
- package/src/{MessageContainer → MessagesContainer}/types.ts +4 -2
- package/src/Send.tsx +40 -22
- package/src/__tests__/DayAnimated.test.tsx +1 -1
- package/src/__tests__/GiftedChat.test.tsx +0 -28
- package/src/__tests__/{MessageContainer.test.tsx → MessagesContainer.test.tsx} +7 -7
- package/src/__tests__/__snapshots__/Actions.test.tsx.snap +31 -23
- package/src/__tests__/__snapshots__/Composer.test.tsx.snap +29 -30
- package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -2
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +31 -54
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +102 -31
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +252 -1
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +189 -49
- package/src/index.ts +1 -1
- package/src/styles.ts +5 -0
- package/src/types.ts +1 -1
- package/CHANGELOG_2.8.1_to_2.8.2-alpha.5.md +0 -374
- /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/index.tsx +0 -0
- /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/styles.ts +0 -0
- /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/types.ts +0 -0
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react-native'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { MessagesContainer } from '..'
|
|
5
5
|
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
6
|
|
|
7
|
-
it('should render <
|
|
7
|
+
it('should render <MessagesContainer /> without crashing', () => {
|
|
8
8
|
// Just verify it renders without throwing
|
|
9
9
|
expect(() => render(
|
|
10
|
-
<
|
|
10
|
+
<MessagesContainer
|
|
11
11
|
messages={[DEFAULT_TEST_MESSAGE]}
|
|
12
12
|
user={{ _id: 1 }}
|
|
13
13
|
/>
|
|
14
14
|
)).not.toThrow()
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
it('should render <
|
|
17
|
+
it('should render <MessagesContainer /> with multiple messages', () => {
|
|
18
18
|
const messages = [
|
|
19
19
|
{ ...DEFAULT_TEST_MESSAGE, _id: 'test1' },
|
|
20
20
|
{ ...DEFAULT_TEST_MESSAGE, _id: 'test2' },
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
expect(() => render(
|
|
24
|
-
<
|
|
24
|
+
<MessagesContainer
|
|
25
25
|
messages={messages}
|
|
26
26
|
user={{ _id: 1 }}
|
|
27
27
|
/>
|
|
28
28
|
)).not.toThrow()
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
it('should render <
|
|
31
|
+
it('should render <MessagesContainer /> with empty messages', () => {
|
|
32
32
|
expect(() => render(
|
|
33
|
-
<
|
|
33
|
+
<MessagesContainer
|
|
34
34
|
messages={[]}
|
|
35
35
|
user={{ _id: 1 }}
|
|
36
36
|
/>
|
|
@@ -2,31 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`should render <Actions /> and compare with snapshot 1`] = `
|
|
4
4
|
<View
|
|
5
|
-
|
|
5
|
+
style={
|
|
6
6
|
{
|
|
7
|
-
"
|
|
8
|
-
"checked": undefined,
|
|
9
|
-
"disabled": false,
|
|
10
|
-
"expanded": undefined,
|
|
11
|
-
"selected": undefined,
|
|
7
|
+
"alignItems": "flex-end",
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
>
|
|
11
|
+
<View
|
|
12
|
+
accessibilityState={
|
|
13
|
+
{
|
|
14
|
+
"busy": undefined,
|
|
15
|
+
"checked": undefined,
|
|
16
|
+
"disabled": false,
|
|
17
|
+
"expanded": undefined,
|
|
18
|
+
"selected": undefined,
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
accessibilityValue={
|
|
22
|
+
{
|
|
23
|
+
"max": undefined,
|
|
24
|
+
"min": undefined,
|
|
25
|
+
"now": undefined,
|
|
26
|
+
"text": undefined,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
accessible={true}
|
|
30
|
+
focusable={true}
|
|
31
|
+
onClick={[Function]}
|
|
32
|
+
onResponderGrant={[Function]}
|
|
33
|
+
onResponderMove={[Function]}
|
|
34
|
+
onResponderRelease={[Function]}
|
|
35
|
+
onResponderTerminate={[Function]}
|
|
36
|
+
onResponderTerminationRequest={[Function]}
|
|
37
|
+
onStartShouldSetResponder={[Function]}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
32
40
|
`;
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`should render <Composer /> and compare with snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
accessibilityLabel="Type a message..."
|
|
6
|
-
accessible={true}
|
|
7
|
-
enablesReturnKeyAutomatically={true}
|
|
8
|
-
keyboardAppearance="default"
|
|
9
|
-
multiline={true}
|
|
10
|
-
onContentSizeChange={[Function]}
|
|
11
|
-
placeholder="Type a message..."
|
|
12
|
-
placeholderTextColor="#b2b2b2"
|
|
4
|
+
<View
|
|
13
5
|
style={
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"fontSize": 16,
|
|
20
|
-
"lineHeight": 22,
|
|
21
|
-
"marginBottom": 5,
|
|
22
|
-
"marginLeft": 10,
|
|
23
|
-
"marginTop": 6,
|
|
24
|
-
},
|
|
25
|
-
undefined,
|
|
26
|
-
undefined,
|
|
27
|
-
{
|
|
28
|
-
"height": 33,
|
|
29
|
-
},
|
|
30
|
-
]
|
|
6
|
+
{
|
|
7
|
+
"flex": 1,
|
|
8
|
+
}
|
|
31
9
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
>
|
|
11
|
+
<TextInput
|
|
12
|
+
accessibilityLabel="Type a message..."
|
|
13
|
+
accessible={true}
|
|
14
|
+
enablesReturnKeyAutomatically={true}
|
|
15
|
+
keyboardAppearance="default"
|
|
16
|
+
multiline={true}
|
|
17
|
+
placeholder="Type a message..."
|
|
18
|
+
placeholderTextColor="#b2b2b2"
|
|
19
|
+
style={
|
|
20
|
+
[
|
|
21
|
+
{
|
|
22
|
+
"fontSize": 16,
|
|
23
|
+
"lineHeight": 22,
|
|
24
|
+
"paddingBottom": 10,
|
|
25
|
+
"paddingTop": 8,
|
|
26
|
+
},
|
|
27
|
+
undefined,
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
testID="Type a message..."
|
|
31
|
+
underlineColorAndroid="transparent"
|
|
32
|
+
value=""
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
36
35
|
`;
|
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`should render <GiftedChat/> and compare with snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"flex": 1,
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
>
|
|
12
|
-
<View
|
|
13
|
-
style={
|
|
14
|
-
{
|
|
15
|
-
"flex": 1,
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
>
|
|
19
|
-
<View
|
|
20
|
-
onLayout={[Function]}
|
|
21
|
-
style={
|
|
22
|
-
[
|
|
23
|
-
{
|
|
24
|
-
"flex": 1,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"overflow": "hidden",
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
testID="GC_WRAPPER"
|
|
32
|
-
/>
|
|
33
|
-
</View>
|
|
34
|
-
</View>
|
|
35
|
-
</KeyboardProvider>
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
exports[`should render <GiftedChat/> with isKeyboardInternallyHandled=false 1`] = `
|
|
39
|
-
<KeyboardProvider>
|
|
40
|
-
<View
|
|
41
|
-
style={
|
|
42
|
-
{
|
|
43
|
-
"flex": 1,
|
|
44
|
-
}
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"flex": 1,
|
|
45
8
|
}
|
|
9
|
+
}
|
|
10
|
+
>
|
|
11
|
+
<KeyboardProvider
|
|
12
|
+
navigationBarTranslucent={true}
|
|
13
|
+
statusBarTranslucent={true}
|
|
46
14
|
>
|
|
47
15
|
<View
|
|
48
16
|
style={
|
|
@@ -52,20 +20,29 @@ exports[`should render <GiftedChat/> with isKeyboardInternallyHandled=false 1`]
|
|
|
52
20
|
}
|
|
53
21
|
>
|
|
54
22
|
<View
|
|
55
|
-
|
|
23
|
+
behavior="padding"
|
|
56
24
|
style={
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"overflow": "hidden",
|
|
63
|
-
},
|
|
64
|
-
]
|
|
25
|
+
{
|
|
26
|
+
"flex": 1,
|
|
27
|
+
}
|
|
65
28
|
}
|
|
66
|
-
|
|
67
|
-
|
|
29
|
+
>
|
|
30
|
+
<View
|
|
31
|
+
onLayout={[Function]}
|
|
32
|
+
style={
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
"flex": 1,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"overflow": "hidden",
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
testID="GC_WRAPPER"
|
|
43
|
+
/>
|
|
44
|
+
</View>
|
|
68
45
|
</View>
|
|
69
|
-
</
|
|
70
|
-
</
|
|
46
|
+
</KeyboardProvider>
|
|
47
|
+
</View>
|
|
71
48
|
`;
|
|
@@ -4,12 +4,14 @@ exports[`should render <InputToolbar /> and compare with snapshot 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
"backgroundColor": "#fff",
|
|
10
|
+
"borderTopColor": "#b2b2b2",
|
|
11
|
+
"borderTopWidth": 0.5,
|
|
12
|
+
},
|
|
13
|
+
undefined,
|
|
14
|
+
],
|
|
13
15
|
undefined,
|
|
14
16
|
]
|
|
15
17
|
}
|
|
@@ -17,46 +19,115 @@ exports[`should render <InputToolbar /> and compare with snapshot 1`] = `
|
|
|
17
19
|
<View
|
|
18
20
|
style={
|
|
19
21
|
[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
"alignItems": "flex-end",
|
|
25
|
+
"flexDirection": "row",
|
|
26
|
+
},
|
|
27
|
+
undefined,
|
|
28
|
+
],
|
|
24
29
|
undefined,
|
|
25
30
|
]
|
|
26
31
|
}
|
|
27
32
|
>
|
|
28
|
-
<
|
|
29
|
-
accessibilityLabel="Type a message..."
|
|
30
|
-
accessible={true}
|
|
31
|
-
enablesReturnKeyAutomatically={true}
|
|
32
|
-
keyboardAppearance="default"
|
|
33
|
-
multiline={true}
|
|
34
|
-
onContentSizeChange={[Function]}
|
|
35
|
-
placeholder="Type a message..."
|
|
36
|
-
placeholderTextColor="#b2b2b2"
|
|
33
|
+
<View
|
|
37
34
|
style={
|
|
35
|
+
{
|
|
36
|
+
"flex": 1,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<TextInput
|
|
41
|
+
accessibilityLabel="Type a message..."
|
|
42
|
+
accessible={true}
|
|
43
|
+
enablesReturnKeyAutomatically={true}
|
|
44
|
+
keyboardAppearance="default"
|
|
45
|
+
multiline={true}
|
|
46
|
+
placeholder="Type a message..."
|
|
47
|
+
placeholderTextColor="#b2b2b2"
|
|
48
|
+
style={
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
"fontSize": 16,
|
|
52
|
+
"lineHeight": 22,
|
|
53
|
+
"paddingBottom": 10,
|
|
54
|
+
"paddingTop": 8,
|
|
55
|
+
},
|
|
56
|
+
undefined,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
testID="Type a message..."
|
|
60
|
+
underlineColorAndroid="transparent"
|
|
61
|
+
value=""
|
|
62
|
+
/>
|
|
63
|
+
</View>
|
|
64
|
+
<View
|
|
65
|
+
collapsable={false}
|
|
66
|
+
jestAnimatedProps={
|
|
67
|
+
{
|
|
68
|
+
"value": {},
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
jestAnimatedStyle={
|
|
72
|
+
{
|
|
73
|
+
"value": {
|
|
74
|
+
"opacity": 0,
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
jestInlineStyle={
|
|
38
79
|
[
|
|
39
80
|
{
|
|
40
|
-
"
|
|
81
|
+
"justifyContent": "flex-end",
|
|
41
82
|
},
|
|
83
|
+
undefined,
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
pointerEvents="none"
|
|
87
|
+
style={
|
|
88
|
+
[
|
|
42
89
|
{
|
|
43
|
-
"
|
|
44
|
-
"lineHeight": 22,
|
|
45
|
-
"marginBottom": 5,
|
|
46
|
-
"marginLeft": 10,
|
|
47
|
-
"marginTop": 6,
|
|
90
|
+
"justifyContent": "flex-end",
|
|
48
91
|
},
|
|
49
92
|
undefined,
|
|
50
|
-
undefined,
|
|
51
93
|
{
|
|
52
|
-
"
|
|
94
|
+
"opacity": 0,
|
|
53
95
|
},
|
|
54
96
|
]
|
|
55
97
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
98
|
+
>
|
|
99
|
+
<View
|
|
100
|
+
accessibilityLabel="send"
|
|
101
|
+
accessibilityRole="button"
|
|
102
|
+
accessibilityState={
|
|
103
|
+
{
|
|
104
|
+
"busy": undefined,
|
|
105
|
+
"checked": undefined,
|
|
106
|
+
"disabled": false,
|
|
107
|
+
"expanded": undefined,
|
|
108
|
+
"selected": undefined,
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
accessibilityValue={
|
|
112
|
+
{
|
|
113
|
+
"max": undefined,
|
|
114
|
+
"min": undefined,
|
|
115
|
+
"now": undefined,
|
|
116
|
+
"text": undefined,
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
accessible={true}
|
|
120
|
+
focusable={true}
|
|
121
|
+
onClick={[Function]}
|
|
122
|
+
onResponderGrant={[Function]}
|
|
123
|
+
onResponderMove={[Function]}
|
|
124
|
+
onResponderRelease={[Function]}
|
|
125
|
+
onResponderTerminate={[Function]}
|
|
126
|
+
onResponderTerminationRequest={[Function]}
|
|
127
|
+
onStartShouldSetResponder={[Function]}
|
|
128
|
+
testID="GC_SEND_TOUCHABLE"
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
60
131
|
</View>
|
|
61
132
|
</View>
|
|
62
133
|
`;
|