react-native-gifted-chat 3.3.0 → 3.3.3
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 +435 -0
- package/README.md +68 -12
- package/lib/Actions.d.ts +16 -0
- package/lib/Actions.d.ts.map +1 -0
- package/lib/Actions.js +65 -0
- package/lib/Actions.js.map +1 -0
- package/lib/Avatar.d.ts +19 -0
- package/lib/Avatar.d.ts.map +1 -0
- package/lib/Avatar.js +93 -0
- package/lib/Avatar.js.map +1 -0
- package/lib/Bubble/index.d.ts +6 -0
- package/lib/Bubble/index.d.ts.map +1 -0
- package/lib/Bubble/index.js +269 -0
- package/lib/Bubble/index.js.map +1 -0
- package/lib/Bubble/styles.d.ts +57 -0
- package/lib/Bubble/styles.d.ts.map +1 -0
- package/lib/Bubble/styles.js +59 -0
- package/lib/Bubble/styles.js.map +1 -0
- package/lib/Bubble/types.d.ts +59 -0
- package/lib/Bubble/types.d.ts.map +1 -0
- package/lib/Bubble/types.js +2 -0
- package/lib/Bubble/types.js.map +1 -0
- package/lib/Color.d.ts +18 -0
- package/lib/Color.d.ts.map +1 -0
- package/lib/Color.js +18 -0
- package/lib/Color.js.map +1 -0
- package/lib/Composer.d.ts +9 -0
- package/lib/Composer.d.ts.map +1 -0
- package/lib/Composer.js +56 -0
- package/lib/Composer.js.map +1 -0
- package/lib/Constant.d.ts +8 -0
- package/lib/Constant.d.ts.map +1 -0
- package/lib/Constant.js +8 -0
- package/lib/Constant.js.map +1 -0
- package/lib/Day/index.d.ts +5 -0
- package/lib/Day/index.d.ts.map +1 -0
- package/lib/Day/index.js +40 -0
- package/lib/Day/index.js.map +1 -0
- package/lib/Day/styles.d.ts +21 -0
- package/lib/Day/styles.d.ts.map +1 -0
- package/lib/Day/styles.js +22 -0
- package/lib/Day/styles.js.map +1 -0
- package/lib/Day/types.d.ts +11 -0
- package/lib/Day/types.d.ts.map +1 -0
- package/lib/Day/types.js +2 -0
- package/lib/Day/types.js.map +1 -0
- package/lib/GiftedAvatar.d.ts +12 -0
- package/lib/GiftedAvatar.d.ts.map +1 -0
- package/lib/GiftedAvatar.js +101 -0
- package/lib/GiftedAvatar.js.map +1 -0
- package/lib/GiftedChat/index.d.ts +10 -0
- package/lib/GiftedChat/index.d.ts.map +1 -0
- package/lib/GiftedChat/index.js +241 -0
- package/lib/GiftedChat/index.js.map +1 -0
- package/lib/GiftedChat/styles.d.ts +13 -0
- package/lib/GiftedChat/styles.d.ts.map +1 -0
- package/lib/GiftedChat/styles.js +13 -0
- package/lib/GiftedChat/styles.js.map +1 -0
- package/lib/GiftedChat/types.d.ts +90 -0
- package/lib/GiftedChat/types.d.ts.map +1 -0
- package/lib/GiftedChat/types.js +2 -0
- package/lib/GiftedChat/types.js.map +1 -0
- package/lib/GiftedChatContext.d.ts +11 -0
- package/lib/GiftedChatContext.d.ts.map +1 -0
- package/lib/GiftedChatContext.js +10 -0
- package/lib/GiftedChatContext.js.map +1 -0
- package/lib/InputToolbar.d.ts +36 -0
- package/lib/InputToolbar.d.ts.map +1 -0
- package/lib/InputToolbar.js +108 -0
- package/lib/InputToolbar.js.map +1 -0
- package/lib/LoadEarlierMessages.d.ts +17 -0
- package/lib/LoadEarlierMessages.d.ts.map +1 -0
- package/lib/LoadEarlierMessages.js +45 -0
- package/lib/LoadEarlierMessages.js.map +1 -0
- package/lib/Message/index.d.ts +6 -0
- package/lib/Message/index.d.ts.map +1 -0
- package/lib/Message/index.js +180 -0
- package/lib/Message/index.js.map +1 -0
- package/lib/Message/styles.d.ts +18 -0
- package/lib/Message/styles.d.ts.map +1 -0
- package/lib/Message/styles.js +18 -0
- package/lib/Message/styles.js.map +1 -0
- package/lib/Message/types.d.ts +25 -0
- package/lib/Message/types.d.ts.map +1 -0
- package/lib/Message/types.js +2 -0
- package/lib/Message/types.js.map +1 -0
- package/lib/MessageAudio.d.ts +3 -0
- package/lib/MessageAudio.d.ts.map +1 -0
- package/lib/MessageAudio.js +25 -0
- package/lib/MessageAudio.js.map +1 -0
- package/lib/MessageImage.d.ts +12 -0
- package/lib/MessageImage.d.ts.map +1 -0
- package/lib/MessageImage.js +164 -0
- package/lib/MessageImage.js.map +1 -0
- package/lib/MessageReply.d.ts +15 -0
- package/lib/MessageReply.d.ts.map +1 -0
- package/lib/MessageReply.js +103 -0
- package/lib/MessageReply.js.map +1 -0
- package/lib/MessageText.d.ts +24 -0
- package/lib/MessageText.d.ts.map +1 -0
- package/lib/MessageText.js +41 -0
- package/lib/MessageText.js.map +1 -0
- package/lib/MessageVideo.d.ts +3 -0
- package/lib/MessageVideo.d.ts.map +1 -0
- package/lib/MessageVideo.js +25 -0
- package/lib/MessageVideo.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/index.d.ts +5 -0
- package/lib/MessagesContainer/components/DayAnimated/index.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/index.js +92 -0
- package/lib/MessagesContainer/components/DayAnimated/index.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.d.ts +12 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.js +12 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/types.d.ts +18 -0
- package/lib/MessagesContainer/components/DayAnimated/types.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/types.js +2 -0
- package/lib/MessagesContainer/components/DayAnimated/types.js.map +1 -0
- package/lib/MessagesContainer/components/Item/index.d.ts +23 -0
- package/lib/MessagesContainer/components/Item/index.d.ts.map +1 -0
- package/lib/MessagesContainer/components/Item/index.js +120 -0
- package/lib/MessagesContainer/components/Item/index.js.map +1 -0
- package/lib/MessagesContainer/components/Item/types.d.ts +19 -0
- package/lib/MessagesContainer/components/Item/types.d.ts.map +1 -0
- package/lib/MessagesContainer/components/Item/types.js +2 -0
- package/lib/MessagesContainer/components/Item/types.js.map +1 -0
- package/lib/MessagesContainer/index.d.ts +6 -0
- package/lib/MessagesContainer/index.d.ts.map +1 -0
- package/lib/MessagesContainer/index.js +258 -0
- package/lib/MessagesContainer/index.js.map +1 -0
- package/lib/MessagesContainer/styles.d.ts +55 -0
- package/lib/MessagesContainer/styles.d.ts.map +1 -0
- package/lib/MessagesContainer/styles.js +42 -0
- package/lib/MessagesContainer/styles.js.map +1 -0
- package/lib/MessagesContainer/types.d.ts +88 -0
- package/lib/MessagesContainer/types.d.ts.map +1 -0
- package/lib/MessagesContainer/types.js +10 -0
- package/lib/MessagesContainer/types.js.map +1 -0
- package/lib/Models.d.ts +58 -0
- package/lib/Models.d.ts.map +1 -0
- package/lib/Models.js +2 -0
- package/lib/Models.js.map +1 -0
- package/lib/QuickReplies.d.ts +16 -0
- package/lib/QuickReplies.d.ts.map +1 -0
- package/lib/QuickReplies.js +108 -0
- package/lib/QuickReplies.js.map +1 -0
- package/lib/Reply/index.d.ts +2 -0
- package/lib/Reply/index.d.ts.map +1 -0
- package/lib/Reply/index.js +2 -0
- package/lib/Reply/index.js.map +1 -0
- package/lib/Reply/types.d.ts +72 -0
- package/lib/Reply/types.d.ts.map +1 -0
- package/lib/Reply/types.js +2 -0
- package/lib/Reply/types.js.map +1 -0
- package/lib/ReplyPreview.d.ts +14 -0
- package/lib/ReplyPreview.d.ts.map +1 -0
- package/lib/ReplyPreview.js +95 -0
- package/lib/ReplyPreview.js.map +1 -0
- package/lib/Send.d.ts +19 -0
- package/lib/Send.d.ts.map +1 -0
- package/lib/Send.js +57 -0
- package/lib/Send.js.map +1 -0
- package/lib/SystemMessage.d.ts +14 -0
- package/lib/SystemMessage.d.ts.map +1 -0
- package/lib/SystemMessage.js +42 -0
- package/lib/SystemMessage.js.map +1 -0
- package/lib/Time.d.ts +12 -0
- package/lib/Time.d.ts.map +1 -0
- package/lib/Time.js +39 -0
- package/lib/Time.js.map +1 -0
- package/lib/TypingIndicator/index.d.ts +5 -0
- package/lib/TypingIndicator/index.d.ts.map +1 -0
- package/lib/TypingIndicator/index.js +94 -0
- package/lib/TypingIndicator/index.js.map +1 -0
- package/lib/TypingIndicator/styles.d.ts +21 -0
- package/lib/TypingIndicator/styles.d.ts.map +1 -0
- package/lib/TypingIndicator/styles.js +22 -0
- package/lib/TypingIndicator/styles.js.map +1 -0
- package/lib/TypingIndicator/types.d.ts +6 -0
- package/lib/TypingIndicator/types.d.ts.map +1 -0
- package/lib/TypingIndicator/types.js +2 -0
- package/lib/TypingIndicator/types.js.map +1 -0
- package/lib/components/MessageReply.d.ts +29 -0
- package/lib/components/MessageReply.d.ts.map +1 -0
- package/lib/components/MessageReply.js +87 -0
- package/lib/components/MessageReply.js.map +1 -0
- package/lib/components/ReplyPreview.d.ts +17 -0
- package/lib/components/ReplyPreview.d.ts.map +1 -0
- package/lib/components/ReplyPreview.js +148 -0
- package/lib/components/ReplyPreview.js.map +1 -0
- package/lib/components/TouchableOpacity.d.ts +9 -0
- package/lib/components/TouchableOpacity.d.ts.map +1 -0
- package/lib/components/TouchableOpacity.js +37 -0
- package/lib/components/TouchableOpacity.js.map +1 -0
- package/lib/hooks/useColorScheme.d.ts +8 -0
- package/lib/hooks/useColorScheme.d.ts.map +1 -0
- package/lib/hooks/useColorScheme.js +17 -0
- package/lib/hooks/useColorScheme.js.map +1 -0
- package/lib/hooks/useUpdateLayoutEffect.d.ts +9 -0
- package/lib/hooks/useUpdateLayoutEffect.d.ts.map +1 -0
- package/lib/hooks/useUpdateLayoutEffect.js +17 -0
- package/lib/hooks/useUpdateLayoutEffect.js.map +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +31 -0
- package/lib/index.js.map +1 -0
- package/lib/linkParser.d.ts +39 -0
- package/lib/linkParser.d.ts.map +1 -0
- package/lib/linkParser.js +154 -0
- package/lib/linkParser.js.map +1 -0
- package/lib/logging.d.ts +3 -0
- package/lib/logging.d.ts.map +1 -0
- package/lib/logging.js +5 -0
- package/lib/logging.js.map +1 -0
- package/lib/styles.d.ts +14 -0
- package/lib/styles.d.ts.map +1 -0
- package/lib/styles.js +23 -0
- package/lib/styles.js.map +1 -0
- package/lib/types.d.ts +19 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +8 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +105 -0
- package/lib/utils.js.map +1 -0
- package/package.json +12 -11
- package/src/Actions.tsx +0 -110
- package/src/Avatar.tsx +0 -169
- package/src/Bubble/index.tsx +0 -407
- package/src/Bubble/styles.ts +0 -66
- package/src/Bubble/types.ts +0 -104
- package/src/Color.ts +0 -17
- package/src/Composer.tsx +0 -100
- package/src/Constant.ts +0 -8
- package/src/Day/index.tsx +0 -63
- package/src/Day/styles.ts +0 -22
- package/src/Day/types.ts +0 -15
- package/src/GiftedAvatar.tsx +0 -187
- package/src/GiftedChat/index.tsx +0 -420
- package/src/GiftedChat/styles.ts +0 -10
- package/src/GiftedChat/types.ts +0 -156
- package/src/GiftedChatContext.ts +0 -25
- package/src/InputToolbar.tsx +0 -177
- package/src/LoadEarlierMessages.tsx +0 -94
- package/src/Message/index.tsx +0 -273
- package/src/Message/styles.ts +0 -18
- package/src/Message/types.ts +0 -26
- package/src/MessageAudio.tsx +0 -29
- package/src/MessageImage.tsx +0 -251
- package/src/MessageReply.tsx +0 -160
- package/src/MessageText.tsx +0 -111
- package/src/MessageVideo.tsx +0 -29
- package/src/MessagesContainer/components/DayAnimated/index.tsx +0 -151
- package/src/MessagesContainer/components/DayAnimated/styles.ts +0 -12
- package/src/MessagesContainer/components/DayAnimated/types.ts +0 -12
- package/src/MessagesContainer/components/Item/index.tsx +0 -197
- package/src/MessagesContainer/components/Item/types.ts +0 -13
- package/src/MessagesContainer/index.tsx +0 -434
- package/src/MessagesContainer/styles.ts +0 -42
- package/src/MessagesContainer/types.ts +0 -102
- package/src/Models.ts +0 -66
- package/src/QuickReplies.tsx +0 -181
- package/src/Reply/index.ts +0 -1
- package/src/Reply/types.ts +0 -80
- package/src/ReplyPreview.tsx +0 -132
- package/src/Send.tsx +0 -115
- package/src/SystemMessage.tsx +0 -79
- package/src/Time.tsx +0 -64
- package/src/TypingIndicator/index.tsx +0 -155
- package/src/TypingIndicator/styles.ts +0 -22
- package/src/TypingIndicator/types.ts +0 -6
- package/src/__tests__/Actions.test.tsx +0 -9
- package/src/__tests__/Avatar.test.tsx +0 -17
- package/src/__tests__/Bubble.test.tsx +0 -17
- package/src/__tests__/Color.test.tsx +0 -5
- package/src/__tests__/Composer.test.tsx +0 -10
- package/src/__tests__/Constant.test.tsx +0 -5
- package/src/__tests__/Day.test.tsx +0 -20
- package/src/__tests__/DayAnimated.test.tsx +0 -46
- package/src/__tests__/GiftedAvatar.test.tsx +0 -10
- package/src/__tests__/GiftedChat.test.tsx +0 -60
- package/src/__tests__/InputToolbar.test.tsx +0 -10
- package/src/__tests__/LoadEarlier.test.tsx +0 -10
- package/src/__tests__/Message.test.tsx +0 -67
- package/src/__tests__/MessageImage.test.tsx +0 -24
- package/src/__tests__/MessageReply.test.tsx +0 -54
- package/src/__tests__/MessageText.test.tsx +0 -15
- package/src/__tests__/MessagesContainer.test.tsx +0 -38
- package/src/__tests__/ReplyPreview.test.tsx +0 -41
- package/src/__tests__/Send.test.tsx +0 -21
- package/src/__tests__/SystemMessage.test.tsx +0 -24
- package/src/__tests__/Time.test.tsx +0 -26
- package/src/__tests__/__snapshots__/Actions.test.tsx.snap +0 -40
- package/src/__tests__/__snapshots__/Avatar.test.tsx.snap +0 -17
- package/src/__tests__/__snapshots__/Bubble.test.tsx.snap +0 -121
- package/src/__tests__/__snapshots__/Color.test.tsx.snap +0 -21
- package/src/__tests__/__snapshots__/Composer.test.tsx.snap +0 -51
- package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -13
- package/src/__tests__/__snapshots__/Day.test.tsx.snap +0 -99
- package/src/__tests__/__snapshots__/DayAnimated.test.tsx.snap +0 -5
- package/src/__tests__/__snapshots__/GiftedAvatar.test.tsx.snap +0 -24
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +0 -169
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +0 -145
- package/src/__tests__/__snapshots__/LoadEarlier.test.tsx.snap +0 -33
- package/src/__tests__/__snapshots__/Message.test.tsx.snap +0 -510
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +0 -293
- package/src/__tests__/__snapshots__/MessageReply.test.tsx.snap +0 -181
- package/src/__tests__/__snapshots__/MessageText.test.tsx.snap +0 -29
- package/src/__tests__/__snapshots__/ReplyPreview.test.tsx.snap +0 -403
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +0 -214
- package/src/__tests__/__snapshots__/SystemMessage.test.tsx.snap +0 -77
- package/src/__tests__/__snapshots__/Time.test.tsx.snap +0 -22
- package/src/__tests__/data.ts +0 -8
- package/src/__tests__/utils.test.ts +0 -31
- package/src/components/MessageReply.tsx +0 -156
- package/src/components/ReplyPreview.tsx +0 -230
- package/src/components/TouchableOpacity.tsx +0 -67
- package/src/hooks/useColorScheme.ts +0 -18
- package/src/hooks/useUpdateLayoutEffect.ts +0 -21
- package/src/index.ts +0 -29
- package/src/linkParser.tsx +0 -255
- package/src/logging.ts +0 -8
- package/src/styles.ts +0 -25
- package/src/types.ts +0 -25
- package/src/utils.ts +0 -134
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState, useMemo } from 'react'
|
|
2
|
-
import { View } from 'react-native'
|
|
3
|
-
import Animated, {
|
|
4
|
-
runOnJS,
|
|
5
|
-
useAnimatedStyle,
|
|
6
|
-
useSharedValue,
|
|
7
|
-
withDelay,
|
|
8
|
-
withRepeat,
|
|
9
|
-
withSequence,
|
|
10
|
-
withTiming,
|
|
11
|
-
} from 'react-native-reanimated'
|
|
12
|
-
import stylesCommon from '../styles'
|
|
13
|
-
|
|
14
|
-
import styles from './styles'
|
|
15
|
-
import { TypingIndicatorProps } from './types'
|
|
16
|
-
|
|
17
|
-
export * from './types'
|
|
18
|
-
|
|
19
|
-
const DotsAnimation = () => {
|
|
20
|
-
const dot1 = useSharedValue(0)
|
|
21
|
-
const dot2 = useSharedValue(0)
|
|
22
|
-
const dot3 = useSharedValue(0)
|
|
23
|
-
|
|
24
|
-
const topY = useMemo(() => -5, [])
|
|
25
|
-
const bottomY = useMemo(() => 5, [])
|
|
26
|
-
const duration = useMemo(() => 500, [])
|
|
27
|
-
|
|
28
|
-
const dot1Style = useAnimatedStyle(() => ({
|
|
29
|
-
transform: [{
|
|
30
|
-
translateY: dot1.value,
|
|
31
|
-
}],
|
|
32
|
-
}), [dot1])
|
|
33
|
-
|
|
34
|
-
const dot2Style = useAnimatedStyle(() => ({
|
|
35
|
-
transform: [{
|
|
36
|
-
translateY: dot2.value,
|
|
37
|
-
}],
|
|
38
|
-
}), [dot2])
|
|
39
|
-
|
|
40
|
-
const dot3Style = useAnimatedStyle(() => ({
|
|
41
|
-
transform: [{
|
|
42
|
-
translateY: dot3.value,
|
|
43
|
-
}],
|
|
44
|
-
}), [dot3])
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
dot1.value = withRepeat(
|
|
48
|
-
withSequence(
|
|
49
|
-
withTiming(topY, { duration }),
|
|
50
|
-
withTiming(bottomY, { duration })
|
|
51
|
-
),
|
|
52
|
-
0,
|
|
53
|
-
true
|
|
54
|
-
)
|
|
55
|
-
}, [dot1, topY, bottomY, duration])
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
dot2.value = withDelay(100,
|
|
59
|
-
withRepeat(
|
|
60
|
-
withSequence(
|
|
61
|
-
withTiming(topY, { duration }),
|
|
62
|
-
withTiming(bottomY, { duration })
|
|
63
|
-
),
|
|
64
|
-
0,
|
|
65
|
-
true
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
}, [dot2, topY, bottomY, duration])
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
dot3.value = withDelay(200,
|
|
72
|
-
withRepeat(
|
|
73
|
-
withSequence(
|
|
74
|
-
withTiming(topY, { duration }),
|
|
75
|
-
withTiming(bottomY, { duration })
|
|
76
|
-
),
|
|
77
|
-
0,
|
|
78
|
-
true
|
|
79
|
-
)
|
|
80
|
-
)
|
|
81
|
-
}, [dot3, topY, bottomY, duration])
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<View style={[stylesCommon.fill, stylesCommon.centerItems, styles.dots]}>
|
|
85
|
-
<Animated.View style={[styles.dot, dot1Style]} />
|
|
86
|
-
<Animated.View style={[styles.dot, dot2Style]} />
|
|
87
|
-
<Animated.View style={[styles.dot, dot3Style]} />
|
|
88
|
-
</View>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export const TypingIndicator = ({ isTyping, style }: TypingIndicatorProps) => {
|
|
93
|
-
const yCoords = useSharedValue(200)
|
|
94
|
-
const heightScale = useSharedValue(0)
|
|
95
|
-
const marginScale = useSharedValue(0)
|
|
96
|
-
|
|
97
|
-
const [isVisible, setIsVisible] = useState(isTyping)
|
|
98
|
-
|
|
99
|
-
const containerStyle = useAnimatedStyle(() => ({
|
|
100
|
-
transform: [
|
|
101
|
-
{
|
|
102
|
-
translateY: yCoords.value,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
height: heightScale.value,
|
|
106
|
-
marginBottom: marginScale.value,
|
|
107
|
-
}), [yCoords, heightScale, marginScale])
|
|
108
|
-
|
|
109
|
-
const slideIn = useCallback(() => {
|
|
110
|
-
const duration = 250
|
|
111
|
-
|
|
112
|
-
yCoords.value = withTiming(0, { duration })
|
|
113
|
-
heightScale.value = withTiming(35, { duration })
|
|
114
|
-
marginScale.value = withTiming(8, { duration })
|
|
115
|
-
}, [yCoords, heightScale, marginScale])
|
|
116
|
-
|
|
117
|
-
const slideOut = useCallback(() => {
|
|
118
|
-
const duration = 250
|
|
119
|
-
|
|
120
|
-
yCoords.value = withTiming(200, { duration }, isFinished => {
|
|
121
|
-
if (isFinished)
|
|
122
|
-
runOnJS(setIsVisible)(false)
|
|
123
|
-
})
|
|
124
|
-
heightScale.value = withTiming(0, { duration })
|
|
125
|
-
marginScale.value = withTiming(0, { duration })
|
|
126
|
-
}, [yCoords, heightScale, marginScale])
|
|
127
|
-
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
if (isVisible)
|
|
130
|
-
if (isTyping)
|
|
131
|
-
slideIn()
|
|
132
|
-
else
|
|
133
|
-
slideOut()
|
|
134
|
-
}, [isVisible, isTyping, slideIn, slideOut])
|
|
135
|
-
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (isTyping)
|
|
138
|
-
setIsVisible(true)
|
|
139
|
-
}, [isTyping])
|
|
140
|
-
|
|
141
|
-
if (!isVisible)
|
|
142
|
-
return null
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<Animated.View
|
|
146
|
-
style={[
|
|
147
|
-
styles.container,
|
|
148
|
-
containerStyle,
|
|
149
|
-
style,
|
|
150
|
-
]}
|
|
151
|
-
>
|
|
152
|
-
<DotsAnimation />
|
|
153
|
-
</Animated.View>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native'
|
|
2
|
-
import { Color } from '../Color'
|
|
3
|
-
|
|
4
|
-
export default StyleSheet.create({
|
|
5
|
-
container: {
|
|
6
|
-
marginLeft: 8,
|
|
7
|
-
width: 45,
|
|
8
|
-
borderRadius: 15,
|
|
9
|
-
backgroundColor: Color.leftBubbleBackground,
|
|
10
|
-
},
|
|
11
|
-
dots: {
|
|
12
|
-
flexDirection: 'row',
|
|
13
|
-
},
|
|
14
|
-
dot: {
|
|
15
|
-
marginLeft: 2,
|
|
16
|
-
marginRight: 2,
|
|
17
|
-
borderRadius: 4,
|
|
18
|
-
width: 8,
|
|
19
|
-
height: 8,
|
|
20
|
-
backgroundColor: 'rgba(0, 0, 0, 0.38)',
|
|
21
|
-
},
|
|
22
|
-
})
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Actions } from '..'
|
|
5
|
-
|
|
6
|
-
it('should render <Actions /> and compare with snapshot', () => {
|
|
7
|
-
const { toJSON } = render(<Actions />)
|
|
8
|
-
expect(toJSON()).toMatchSnapshot()
|
|
9
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Avatar } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
it('should render <Avatar /> and compare with snapshot', () => {
|
|
8
|
-
const { toJSON } = render(
|
|
9
|
-
<Avatar
|
|
10
|
-
renderAvatar={() => 'renderAvatar'}
|
|
11
|
-
position='left'
|
|
12
|
-
currentMessage={DEFAULT_TEST_MESSAGE}
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
expect(toJSON()).toMatchSnapshot()
|
|
17
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Bubble } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
it('should render <Bubble /> and compare with snapshot', () => {
|
|
8
|
-
const { toJSON } = render(
|
|
9
|
-
<Bubble
|
|
10
|
-
user={{ _id: 1 }}
|
|
11
|
-
currentMessage={DEFAULT_TEST_MESSAGE}
|
|
12
|
-
position='left'
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
expect(toJSON()).toMatchSnapshot()
|
|
17
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Composer } from '..'
|
|
5
|
-
|
|
6
|
-
it('should render <Composer /> and compare with snapshot', () => {
|
|
7
|
-
const { toJSON } = render(<Composer />)
|
|
8
|
-
|
|
9
|
-
expect(toJSON()).toMatchSnapshot()
|
|
10
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Day } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
describe('Day', () => {
|
|
8
|
-
it('should not render <Day /> and compare with snapshot', () => {
|
|
9
|
-
const { toJSON } = render(<Day createdAt={DEFAULT_TEST_MESSAGE.createdAt} />)
|
|
10
|
-
|
|
11
|
-
expect(toJSON()).toMatchSnapshot()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('should render <Day /> and compare with snapshot', () => {
|
|
15
|
-
const { toJSON } = render(
|
|
16
|
-
<Day createdAt={DEFAULT_TEST_MESSAGE.createdAt} />
|
|
17
|
-
)
|
|
18
|
-
expect(toJSON()).toMatchSnapshot()
|
|
19
|
-
})
|
|
20
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text } from 'react-native'
|
|
3
|
-
import { render } from '@testing-library/react-native'
|
|
4
|
-
import { DayProps } from '../Day'
|
|
5
|
-
import { DayAnimated } from '../MessagesContainer/components/DayAnimated'
|
|
6
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
7
|
-
|
|
8
|
-
const mockDaysPositions = { value: {} }
|
|
9
|
-
const mockScrolledY = { value: 0 }
|
|
10
|
-
const mockListHeight = { value: 800 }
|
|
11
|
-
|
|
12
|
-
describe('DayAnimated', () => {
|
|
13
|
-
it('should render DayAnimated with default Day component', () => {
|
|
14
|
-
const { toJSON } = render(
|
|
15
|
-
<DayAnimated
|
|
16
|
-
scrolledY={mockScrolledY}
|
|
17
|
-
daysPositions={mockDaysPositions}
|
|
18
|
-
listHeight={mockListHeight}
|
|
19
|
-
messages={[DEFAULT_TEST_MESSAGE]}
|
|
20
|
-
isLoading={false}
|
|
21
|
-
/>
|
|
22
|
-
)
|
|
23
|
-
expect(toJSON()).toMatchSnapshot()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('should use custom renderDay when provided', () => {
|
|
27
|
-
const customRenderDay = jest.fn((props: DayProps) => (
|
|
28
|
-
<View testID='custom-day'>
|
|
29
|
-
<Text>Custom Day: {props.createdAt.toLocaleString()}</Text>
|
|
30
|
-
</View>
|
|
31
|
-
))
|
|
32
|
-
|
|
33
|
-
const { toJSON } = render(
|
|
34
|
-
<DayAnimated
|
|
35
|
-
scrolledY={mockScrolledY}
|
|
36
|
-
daysPositions={mockDaysPositions}
|
|
37
|
-
listHeight={mockListHeight}
|
|
38
|
-
messages={[DEFAULT_TEST_MESSAGE]}
|
|
39
|
-
isLoading={false}
|
|
40
|
-
renderDay={customRenderDay}
|
|
41
|
-
/>
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
expect(toJSON()).toMatchSnapshot()
|
|
45
|
-
})
|
|
46
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { GiftedAvatar } from '..'
|
|
5
|
-
|
|
6
|
-
it('should render <GiftedAvatar /> and compare with snapshot', () => {
|
|
7
|
-
const { toJSON } = render(<GiftedAvatar />)
|
|
8
|
-
|
|
9
|
-
expect(toJSON()).toMatchSnapshot()
|
|
10
|
-
})
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { GiftedChat } from '..'
|
|
5
|
-
|
|
6
|
-
const messages = [
|
|
7
|
-
{
|
|
8
|
-
_id: 1,
|
|
9
|
-
text: 'Hello developer',
|
|
10
|
-
createdAt: new Date(),
|
|
11
|
-
user: {
|
|
12
|
-
_id: 2,
|
|
13
|
-
name: 'John Doe',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
it('should render <GiftedChat/> and compare with snapshot', () => {
|
|
19
|
-
const { toJSON } = render(
|
|
20
|
-
<GiftedChat
|
|
21
|
-
messages={messages}
|
|
22
|
-
onSend={() => {}}
|
|
23
|
-
user={{
|
|
24
|
-
_id: 1,
|
|
25
|
-
}}
|
|
26
|
-
/>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
expect(toJSON()).toMatchSnapshot()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('should render <GiftedChat/> with light colorScheme and compare with snapshot', () => {
|
|
33
|
-
const { toJSON } = render(
|
|
34
|
-
<GiftedChat
|
|
35
|
-
messages={messages}
|
|
36
|
-
onSend={() => {}}
|
|
37
|
-
user={{
|
|
38
|
-
_id: 1,
|
|
39
|
-
}}
|
|
40
|
-
colorScheme='light'
|
|
41
|
-
/>
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
expect(toJSON()).toMatchSnapshot()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('should render <GiftedChat/> with dark colorScheme and compare with snapshot', () => {
|
|
48
|
-
const { toJSON } = render(
|
|
49
|
-
<GiftedChat
|
|
50
|
-
messages={messages}
|
|
51
|
-
onSend={() => {}}
|
|
52
|
-
user={{
|
|
53
|
-
_id: 1,
|
|
54
|
-
}}
|
|
55
|
-
colorScheme='dark'
|
|
56
|
-
/>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
expect(toJSON()).toMatchSnapshot()
|
|
60
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { InputToolbar } from '..'
|
|
5
|
-
|
|
6
|
-
it('should render <InputToolbar /> and compare with snapshot', () => {
|
|
7
|
-
const { toJSON } = render(<InputToolbar />)
|
|
8
|
-
|
|
9
|
-
expect(toJSON()).toMatchSnapshot()
|
|
10
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { LoadEarlierMessages } from '..'
|
|
5
|
-
|
|
6
|
-
it('should render <LoadEarlierMessages /> and compare with snapshot', () => {
|
|
7
|
-
const { toJSON } = render(<LoadEarlierMessages isAvailable isLoading={false} onPress={() => {}} />)
|
|
8
|
-
|
|
9
|
-
expect(toJSON()).toMatchSnapshot()
|
|
10
|
-
})
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Message } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
describe('Message component', () => {
|
|
8
|
-
it('should render <Message /> and compare with snapshot', () => {
|
|
9
|
-
const { toJSON } = render(
|
|
10
|
-
<Message
|
|
11
|
-
key='123'
|
|
12
|
-
user={{ _id: 1 }}
|
|
13
|
-
currentMessage={{
|
|
14
|
-
_id: 1,
|
|
15
|
-
text: 'test',
|
|
16
|
-
createdAt: 1554744013721,
|
|
17
|
-
user: { _id: 1 },
|
|
18
|
-
}}
|
|
19
|
-
position='left'
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
expect(toJSON()).toMatchSnapshot()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('should NOT render <Message />', () => {
|
|
27
|
-
const { toJSON } = render(
|
|
28
|
-
<Message key='123' user={{ _id: 1 }} currentMessage={null} position='left' />
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
expect(toJSON()).toMatchSnapshot()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('should render <Message /> with Avatar', () => {
|
|
35
|
-
const { toJSON } = render(
|
|
36
|
-
<Message
|
|
37
|
-
key='123'
|
|
38
|
-
user={{ _id: 1 }}
|
|
39
|
-
currentMessage={DEFAULT_TEST_MESSAGE}
|
|
40
|
-
position='left'
|
|
41
|
-
isUserAvatarVisible
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
expect(toJSON()).toMatchSnapshot()
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('should render null if user has no Avatar', () => {
|
|
49
|
-
const { toJSON } = render(
|
|
50
|
-
<Message
|
|
51
|
-
key='123'
|
|
52
|
-
user={{ _id: 1 }}
|
|
53
|
-
currentMessage={{
|
|
54
|
-
...DEFAULT_TEST_MESSAGE,
|
|
55
|
-
user: {
|
|
56
|
-
_id: 1,
|
|
57
|
-
avatar: undefined,
|
|
58
|
-
},
|
|
59
|
-
}}
|
|
60
|
-
position='left'
|
|
61
|
-
isUserAvatarVisible
|
|
62
|
-
/>
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
expect(toJSON()).toMatchSnapshot()
|
|
66
|
-
})
|
|
67
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { MessageImage } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
describe('MessageImage', () => {
|
|
8
|
-
it('should not render <MessageImage /> and compare with snapshot', () => {
|
|
9
|
-
const { toJSON } = render(<MessageImage currentMessage={null} />)
|
|
10
|
-
expect(toJSON()).toMatchSnapshot()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('should render <MessageImage /> and compare with snapshot', () => {
|
|
14
|
-
const { toJSON } = render(
|
|
15
|
-
<MessageImage
|
|
16
|
-
currentMessage={{
|
|
17
|
-
...DEFAULT_TEST_MESSAGE,
|
|
18
|
-
image: 'url://to/image.png',
|
|
19
|
-
}}
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
expect(toJSON()).toMatchSnapshot()
|
|
23
|
-
})
|
|
24
|
-
})
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { MessageReply } from '../components/MessageReply'
|
|
5
|
-
import { IMessage, ReplyMessage } from '../Models'
|
|
6
|
-
|
|
7
|
-
const replyMessage: ReplyMessage = {
|
|
8
|
-
_id: 'reply-1',
|
|
9
|
-
text: 'Original message text',
|
|
10
|
-
user: {
|
|
11
|
-
_id: 2,
|
|
12
|
-
name: 'John Doe',
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const currentMessage: IMessage = {
|
|
17
|
-
_id: 'msg-1',
|
|
18
|
-
text: 'Reply text',
|
|
19
|
-
createdAt: new Date(),
|
|
20
|
-
user: {
|
|
21
|
-
_id: 1,
|
|
22
|
-
name: 'Jane Doe',
|
|
23
|
-
},
|
|
24
|
-
replyMessage,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
it('should render <MessageReply /> and compare with snapshot', () => {
|
|
28
|
-
const { toJSON } = render(
|
|
29
|
-
<MessageReply
|
|
30
|
-
replyMessage={replyMessage}
|
|
31
|
-
currentMessage={currentMessage}
|
|
32
|
-
position='left'
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
expect(toJSON()).toMatchSnapshot()
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('should render <MessageReply /> on right position and compare with snapshot', () => {
|
|
40
|
-
const currentMessageFromCurrentUser: IMessage = {
|
|
41
|
-
...currentMessage,
|
|
42
|
-
user: replyMessage.user,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const { toJSON } = render(
|
|
46
|
-
<MessageReply
|
|
47
|
-
replyMessage={replyMessage}
|
|
48
|
-
currentMessage={currentMessageFromCurrentUser}
|
|
49
|
-
position='right'
|
|
50
|
-
/>
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
expect(toJSON()).toMatchSnapshot()
|
|
54
|
-
})
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { MessageText } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
it('should render <MessageText /> and compare with snapshot', () => {
|
|
8
|
-
const { toJSON } = render(
|
|
9
|
-
<MessageText
|
|
10
|
-
currentMessage={DEFAULT_TEST_MESSAGE}
|
|
11
|
-
/>
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
expect(toJSON()).toMatchSnapshot()
|
|
15
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { MessagesContainer } from '..'
|
|
5
|
-
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
|
-
|
|
7
|
-
it('should render <MessagesContainer /> without crashing', () => {
|
|
8
|
-
// Just verify it renders without throwing
|
|
9
|
-
expect(() => render(
|
|
10
|
-
<MessagesContainer
|
|
11
|
-
messages={[DEFAULT_TEST_MESSAGE]}
|
|
12
|
-
user={{ _id: 1 }}
|
|
13
|
-
/>
|
|
14
|
-
)).not.toThrow()
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('should render <MessagesContainer /> with multiple messages', () => {
|
|
18
|
-
const messages = [
|
|
19
|
-
{ ...DEFAULT_TEST_MESSAGE, _id: 'test1' },
|
|
20
|
-
{ ...DEFAULT_TEST_MESSAGE, _id: 'test2' },
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
expect(() => render(
|
|
24
|
-
<MessagesContainer
|
|
25
|
-
messages={messages}
|
|
26
|
-
user={{ _id: 1 }}
|
|
27
|
-
/>
|
|
28
|
-
)).not.toThrow()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('should render <MessagesContainer /> with empty messages', () => {
|
|
32
|
-
expect(() => render(
|
|
33
|
-
<MessagesContainer
|
|
34
|
-
messages={[]}
|
|
35
|
-
user={{ _id: 1 }}
|
|
36
|
-
/>
|
|
37
|
-
)).not.toThrow()
|
|
38
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { ReplyPreview } from '../components/ReplyPreview'
|
|
5
|
-
import { ReplyMessage } from '../Models'
|
|
6
|
-
|
|
7
|
-
const replyMessage: ReplyMessage = {
|
|
8
|
-
_id: 'reply-1',
|
|
9
|
-
text: 'Original message to reply to',
|
|
10
|
-
user: {
|
|
11
|
-
_id: 2,
|
|
12
|
-
name: 'John Doe',
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
it('should render <ReplyPreview /> and compare with snapshot', () => {
|
|
17
|
-
const { toJSON } = render(
|
|
18
|
-
<ReplyPreview
|
|
19
|
-
replyMessage={replyMessage}
|
|
20
|
-
onClearReply={() => {}}
|
|
21
|
-
/>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
expect(toJSON()).toMatchSnapshot()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('should render <ReplyPreview /> with image and compare with snapshot', () => {
|
|
28
|
-
const replyWithImage: ReplyMessage = {
|
|
29
|
-
...replyMessage,
|
|
30
|
-
image: 'https://example.com/image.jpg',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const { toJSON } = render(
|
|
34
|
-
<ReplyPreview
|
|
35
|
-
replyMessage={replyWithImage}
|
|
36
|
-
onClearReply={() => {}}
|
|
37
|
-
/>
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
expect(toJSON()).toMatchSnapshot()
|
|
41
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
|
|
4
|
-
import { Send } from '..'
|
|
5
|
-
|
|
6
|
-
describe('Send', () => {
|
|
7
|
-
it('should not render <Send /> and compare with snapshot', () => {
|
|
8
|
-
const { toJSON } = render(<Send />)
|
|
9
|
-
expect(toJSON()).toMatchSnapshot()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('should always render <Send /> and compare with snapshot', () => {
|
|
13
|
-
const { toJSON } = render(<Send isSendButtonAlwaysVisible />)
|
|
14
|
-
expect(toJSON()).toMatchSnapshot()
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('should render <Send /> where there is input and compare with snapshot', () => {
|
|
18
|
-
const { toJSON } = render(<Send text='test input' />)
|
|
19
|
-
expect(toJSON()).toMatchSnapshot()
|
|
20
|
-
})
|
|
21
|
-
})
|