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.
Files changed (33) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/README.md +71 -95
  3. package/package.json +2 -2
  4. package/src/Actions.tsx +27 -18
  5. package/src/Composer.tsx +21 -84
  6. package/src/Constant.ts +0 -9
  7. package/src/GiftedChat/index.tsx +52 -163
  8. package/src/GiftedChat/types.ts +11 -12
  9. package/src/InputToolbar.tsx +6 -11
  10. package/src/MessageImage.tsx +135 -65
  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 +18 -14
  14. package/src/{MessageContainer → MessagesContainer}/styles.ts +12 -5
  15. package/src/{MessageContainer → MessagesContainer}/types.ts +4 -2
  16. package/src/Send.tsx +40 -22
  17. package/src/__tests__/DayAnimated.test.tsx +1 -1
  18. package/src/__tests__/GiftedChat.test.tsx +0 -28
  19. package/src/__tests__/{MessageContainer.test.tsx → MessagesContainer.test.tsx} +7 -7
  20. package/src/__tests__/__snapshots__/Actions.test.tsx.snap +31 -23
  21. package/src/__tests__/__snapshots__/Composer.test.tsx.snap +29 -30
  22. package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -2
  23. package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +31 -54
  24. package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +102 -31
  25. package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +252 -1
  26. package/src/__tests__/__snapshots__/Send.test.tsx.snap +189 -49
  27. package/src/index.ts +1 -1
  28. package/src/styles.ts +5 -0
  29. package/src/types.ts +1 -1
  30. package/CHANGELOG_2.8.1_to_2.8.2-alpha.5.md +0 -374
  31. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/index.tsx +0 -0
  32. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/styles.ts +0 -0
  33. /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 { MessageContainer } from '..'
4
+ import { MessagesContainer } from '..'
5
5
  import { DEFAULT_TEST_MESSAGE } from './data'
6
6
 
7
- it('should render <MessageContainer /> without crashing', () => {
7
+ it('should render <MessagesContainer /> without crashing', () => {
8
8
  // Just verify it renders without throwing
9
9
  expect(() => render(
10
- <MessageContainer
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 <MessageContainer /> with multiple messages', () => {
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
- <MessageContainer
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 <MessageContainer /> with empty messages', () => {
31
+ it('should render <MessagesContainer /> with empty messages', () => {
32
32
  expect(() => render(
33
- <MessageContainer
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
- accessibilityState={
5
+ style={
6
6
  {
7
- "busy": undefined,
8
- "checked": undefined,
9
- "disabled": false,
10
- "expanded": undefined,
11
- "selected": undefined,
7
+ "alignItems": "flex-end",
12
8
  }
13
9
  }
14
- accessibilityValue={
15
- {
16
- "max": undefined,
17
- "min": undefined,
18
- "now": undefined,
19
- "text": undefined,
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
- accessible={true}
23
- focusable={true}
24
- onClick={[Function]}
25
- onResponderGrant={[Function]}
26
- onResponderMove={[Function]}
27
- onResponderRelease={[Function]}
28
- onResponderTerminate={[Function]}
29
- onResponderTerminationRequest={[Function]}
30
- onStartShouldSetResponder={[Function]}
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
- <TextInput
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
- "flex": 1,
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
- testID="Type a message..."
33
- underlineColorAndroid="transparent"
34
- value=""
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
  `;
@@ -3,8 +3,6 @@
3
3
  exports[`should compare Constant with snapshot 1`] = `
4
4
  {
5
5
  "DATE_FORMAT": "D MMMM",
6
- "MAX_COMPOSER_HEIGHT": 200,
7
- "MIN_COMPOSER_HEIGHT": 33,
8
6
  "TEST_ID": {
9
7
  "LOADING_WRAPPER": "GC_LOADING_CONTAINER",
10
8
  "SEND_TOUCHABLE": "GC_SEND_TOUCHABLE",
@@ -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
- <KeyboardProvider>
5
- <View
6
- style={
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
- onLayout={[Function]}
23
+ behavior="padding"
56
24
  style={
57
- [
58
- {
59
- "flex": 1,
60
- },
61
- {
62
- "overflow": "hidden",
63
- },
64
- ]
25
+ {
26
+ "flex": 1,
27
+ }
65
28
  }
66
- testID="GC_WRAPPER"
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
- </View>
70
- </KeyboardProvider>
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
- "backgroundColor": "#fff",
9
- "borderTopColor": "#b2b2b2",
10
- "borderTopWidth": 0.5,
11
- },
12
- false,
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
- "alignItems": "flex-end",
22
- "flexDirection": "row",
23
- },
22
+ [
23
+ {
24
+ "alignItems": "flex-end",
25
+ "flexDirection": "row",
26
+ },
27
+ undefined,
28
+ ],
24
29
  undefined,
25
30
  ]
26
31
  }
27
32
  >
28
- <TextInput
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
- "flex": 1,
81
+ "justifyContent": "flex-end",
41
82
  },
83
+ undefined,
84
+ ]
85
+ }
86
+ pointerEvents="none"
87
+ style={
88
+ [
42
89
  {
43
- "fontSize": 16,
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
- "height": 33,
94
+ "opacity": 0,
53
95
  },
54
96
  ]
55
97
  }
56
- testID="Type a message..."
57
- underlineColorAndroid="transparent"
58
- value=""
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
  `;