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
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
ImageStyle,
|
|
5
|
+
Pressable,
|
|
6
|
+
StyleProp,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Text,
|
|
9
|
+
TextStyle,
|
|
10
|
+
View,
|
|
11
|
+
ViewStyle,
|
|
12
|
+
} from 'react-native'
|
|
13
|
+
import Animated, {
|
|
14
|
+
useAnimatedStyle,
|
|
15
|
+
useSharedValue,
|
|
16
|
+
withTiming,
|
|
17
|
+
Easing,
|
|
18
|
+
interpolate,
|
|
19
|
+
runOnJS,
|
|
20
|
+
} from 'react-native-reanimated'
|
|
21
|
+
|
|
22
|
+
import { useColorScheme } from '../hooks/useColorScheme'
|
|
23
|
+
import { ReplyMessage } from '../Models'
|
|
24
|
+
|
|
25
|
+
const ANIMATION_DURATION = 200
|
|
26
|
+
const ANIMATION_EASING = Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
27
|
+
const DEFAULT_HEIGHT = 68
|
|
28
|
+
|
|
29
|
+
export interface ReplyPreviewProps {
|
|
30
|
+
/** The reply message to preview */
|
|
31
|
+
replyMessage: ReplyMessage
|
|
32
|
+
/** Callback to clear the reply */
|
|
33
|
+
onClearReply?: () => void
|
|
34
|
+
/** Container style */
|
|
35
|
+
containerStyle?: StyleProp<ViewStyle>
|
|
36
|
+
/** Text style */
|
|
37
|
+
textStyle?: StyleProp<TextStyle>
|
|
38
|
+
/** Image style */
|
|
39
|
+
imageStyle?: StyleProp<ImageStyle>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
borderIndicator: {
|
|
44
|
+
backgroundColor: '#0084ff',
|
|
45
|
+
borderTopLeftRadius: 4,
|
|
46
|
+
height: '100%',
|
|
47
|
+
width: 4,
|
|
48
|
+
},
|
|
49
|
+
clearButton: {
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
borderRadius: 12,
|
|
52
|
+
height: 24,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
width: 24,
|
|
55
|
+
},
|
|
56
|
+
clearButtonText: {
|
|
57
|
+
fontSize: 18,
|
|
58
|
+
fontWeight: '600',
|
|
59
|
+
},
|
|
60
|
+
container: {
|
|
61
|
+
borderRadius: 8,
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
marginBottom: 8,
|
|
64
|
+
marginHorizontal: 10,
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
},
|
|
67
|
+
containerDark: {
|
|
68
|
+
backgroundColor: '#2c2c2e',
|
|
69
|
+
},
|
|
70
|
+
containerLight: {
|
|
71
|
+
backgroundColor: '#e9e9eb',
|
|
72
|
+
},
|
|
73
|
+
content: {
|
|
74
|
+
flex: 1,
|
|
75
|
+
paddingHorizontal: 10,
|
|
76
|
+
paddingVertical: 8,
|
|
77
|
+
},
|
|
78
|
+
image: {
|
|
79
|
+
borderRadius: 4,
|
|
80
|
+
height: 40,
|
|
81
|
+
marginRight: 8,
|
|
82
|
+
width: 40,
|
|
83
|
+
},
|
|
84
|
+
row: {
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
},
|
|
88
|
+
text: {
|
|
89
|
+
fontSize: 14,
|
|
90
|
+
},
|
|
91
|
+
textDark: {
|
|
92
|
+
color: '#fff',
|
|
93
|
+
},
|
|
94
|
+
textLight: {
|
|
95
|
+
color: '#333',
|
|
96
|
+
},
|
|
97
|
+
username: {
|
|
98
|
+
color: '#0084ff',
|
|
99
|
+
fontSize: 13,
|
|
100
|
+
fontWeight: '600',
|
|
101
|
+
marginBottom: 2,
|
|
102
|
+
},
|
|
103
|
+
wrapper: {
|
|
104
|
+
overflow: 'hidden',
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
export function ReplyPreview ({
|
|
109
|
+
replyMessage,
|
|
110
|
+
onClearReply,
|
|
111
|
+
containerStyle,
|
|
112
|
+
textStyle,
|
|
113
|
+
imageStyle,
|
|
114
|
+
}: ReplyPreviewProps) {
|
|
115
|
+
const colorScheme = useColorScheme()
|
|
116
|
+
const isDark = colorScheme === 'dark'
|
|
117
|
+
|
|
118
|
+
const animationProgress = useSharedValue(0)
|
|
119
|
+
const contentHeight = useSharedValue(DEFAULT_HEIGHT)
|
|
120
|
+
|
|
121
|
+
// Animate in on mount
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
animationProgress.value = withTiming(1, {
|
|
124
|
+
duration: ANIMATION_DURATION,
|
|
125
|
+
easing: ANIMATION_EASING,
|
|
126
|
+
})
|
|
127
|
+
}, [animationProgress])
|
|
128
|
+
|
|
129
|
+
const handleClear = () => {
|
|
130
|
+
'worklet'
|
|
131
|
+
animationProgress.value = withTiming(0, {
|
|
132
|
+
duration: ANIMATION_DURATION,
|
|
133
|
+
easing: ANIMATION_EASING,
|
|
134
|
+
}, finished => {
|
|
135
|
+
if (finished && onClearReply)
|
|
136
|
+
runOnJS(onClearReply)()
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const wrapperAnimatedStyle = useAnimatedStyle(() => {
|
|
141
|
+
const height = interpolate(
|
|
142
|
+
animationProgress.value,
|
|
143
|
+
[0, 1],
|
|
144
|
+
[0, contentHeight.value]
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
const opacity = interpolate(
|
|
148
|
+
animationProgress.value,
|
|
149
|
+
[0, 0.5, 1],
|
|
150
|
+
[0, 0.5, 1]
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
const translateY = interpolate(
|
|
154
|
+
animationProgress.value,
|
|
155
|
+
[0, 1],
|
|
156
|
+
[10, 0]
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
height,
|
|
161
|
+
opacity,
|
|
162
|
+
transform: [{ translateY }],
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const displayName = replyMessage.user?.name || 'Unknown'
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Animated.View style={[styles.wrapper, wrapperAnimatedStyle]}>
|
|
170
|
+
<View
|
|
171
|
+
style={[
|
|
172
|
+
styles.container,
|
|
173
|
+
isDark ? styles.containerDark : styles.containerLight,
|
|
174
|
+
containerStyle,
|
|
175
|
+
]}
|
|
176
|
+
onLayout={e => {
|
|
177
|
+
const newHeight = e.nativeEvent.layout.height + 8
|
|
178
|
+
// Animate height change smoothly when content changes
|
|
179
|
+
contentHeight.value = withTiming(newHeight, {
|
|
180
|
+
duration: ANIMATION_DURATION,
|
|
181
|
+
easing: ANIMATION_EASING,
|
|
182
|
+
})
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<View style={styles.borderIndicator} />
|
|
186
|
+
<View style={styles.content}>
|
|
187
|
+
<View style={styles.row}>
|
|
188
|
+
{replyMessage.image && (
|
|
189
|
+
<Image
|
|
190
|
+
source={{ uri: replyMessage.image }}
|
|
191
|
+
style={[styles.image, imageStyle]}
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
<View style={{ flex: 1 }}>
|
|
195
|
+
<Text style={styles.username} numberOfLines={1}>
|
|
196
|
+
Replying to {displayName}
|
|
197
|
+
</Text>
|
|
198
|
+
{replyMessage.text && (
|
|
199
|
+
<Text
|
|
200
|
+
style={[
|
|
201
|
+
styles.text,
|
|
202
|
+
isDark ? styles.textDark : styles.textLight,
|
|
203
|
+
textStyle,
|
|
204
|
+
]}
|
|
205
|
+
numberOfLines={2}
|
|
206
|
+
>
|
|
207
|
+
{replyMessage.text}
|
|
208
|
+
</Text>
|
|
209
|
+
)}
|
|
210
|
+
</View>
|
|
211
|
+
</View>
|
|
212
|
+
</View>
|
|
213
|
+
<Pressable
|
|
214
|
+
style={styles.clearButton}
|
|
215
|
+
onPress={handleClear}
|
|
216
|
+
hitSlop={8}
|
|
217
|
+
>
|
|
218
|
+
<Text
|
|
219
|
+
style={[
|
|
220
|
+
styles.clearButtonText,
|
|
221
|
+
isDark ? styles.textDark : styles.textLight,
|
|
222
|
+
]}
|
|
223
|
+
>
|
|
224
|
+
×
|
|
225
|
+
</Text>
|
|
226
|
+
</Pressable>
|
|
227
|
+
</View>
|
|
228
|
+
</Animated.View>
|
|
229
|
+
)
|
|
230
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import * as utils from './utils'
|
|
2
|
+
|
|
1
3
|
export * from './GiftedChat'
|
|
2
4
|
export * from './Constant'
|
|
3
|
-
export
|
|
5
|
+
export { utils }
|
|
4
6
|
export * from './GiftedChatContext'
|
|
5
7
|
export * from './types'
|
|
6
8
|
export * from './linkParser'
|
|
9
|
+
export * from './Reply'
|
|
7
10
|
export { Actions } from './Actions'
|
|
8
11
|
export { Avatar } from './Avatar'
|
|
9
12
|
export { Bubble } from './Bubble'
|
|
@@ -21,4 +24,6 @@ export { Time } from './Time'
|
|
|
21
24
|
export { GiftedAvatar } from './GiftedAvatar'
|
|
22
25
|
export { MessageAudio } from './MessageAudio'
|
|
23
26
|
export { MessageVideo } from './MessageVideo'
|
|
27
|
+
export { MessageReply } from './components/MessageReply'
|
|
28
|
+
export { ReplyPreview } from './components/ReplyPreview'
|
|
24
29
|
export { useColorScheme } from './hooks/useColorScheme'
|
package/src/types.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export * from './Models'
|
|
2
2
|
|
|
3
|
-
export { ActionsProps } from './Actions'
|
|
4
|
-
export { AvatarProps } from './Avatar'
|
|
5
|
-
export {
|
|
3
|
+
export type { ActionsProps } from './Actions'
|
|
4
|
+
export type { AvatarProps } from './Avatar'
|
|
5
|
+
export type {
|
|
6
6
|
BubbleProps,
|
|
7
7
|
RenderMessageImageProps,
|
|
8
8
|
RenderMessageVideoProps,
|
|
9
9
|
RenderMessageAudioProps,
|
|
10
10
|
RenderMessageTextProps
|
|
11
11
|
} from './Bubble'
|
|
12
|
-
export { ComposerProps } from './Composer'
|
|
13
|
-
export { DayProps } from './Day'
|
|
14
|
-
export { GiftedAvatarProps } from './GiftedAvatar'
|
|
15
|
-
export { InputToolbarProps } from './InputToolbar'
|
|
16
|
-
export { LoadEarlierMessagesProps } from './LoadEarlierMessages'
|
|
17
|
-
export { MessageProps } from './Message'
|
|
18
|
-
export { MessagesContainerProps } from './MessagesContainer'
|
|
19
|
-
export { MessageImageProps } from './MessageImage'
|
|
20
|
-
export { MessageTextProps } from './MessageText'
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
12
|
+
export type { ComposerProps } from './Composer'
|
|
13
|
+
export type { DayProps } from './Day'
|
|
14
|
+
export type { GiftedAvatarProps } from './GiftedAvatar'
|
|
15
|
+
export type { InputToolbarProps, ReplyPreviewProps } from './InputToolbar'
|
|
16
|
+
export type { LoadEarlierMessagesProps } from './LoadEarlierMessages'
|
|
17
|
+
export type { MessageProps } from './Message'
|
|
18
|
+
export type { MessagesContainerProps } from './MessagesContainer'
|
|
19
|
+
export type { MessageImageProps } from './MessageImage'
|
|
20
|
+
export type { MessageTextProps } from './MessageText'
|
|
21
|
+
export type { MessageReplyProps } from './components/MessageReply'
|
|
22
|
+
export type { QuickRepliesProps } from './QuickReplies'
|
|
23
|
+
export type { SendProps } from './Send'
|
|
24
|
+
export type { SystemMessageProps } from './SystemMessage'
|
|
25
|
+
export type { TimeProps } from './Time'
|
package/src/utils.ts
CHANGED
|
@@ -14,9 +14,17 @@ export function renderComponentOrElement<TProps extends Record<string, any>>(
|
|
|
14
14
|
return React.cloneElement(component, props as any)
|
|
15
15
|
|
|
16
16
|
if (typeof component === 'function') {
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// Check if it's a class component (has prototype.isReactComponent)
|
|
18
|
+
// Class components must use React.createElement
|
|
19
|
+
const isClassComponent = component.prototype && component.prototype.isReactComponent
|
|
20
|
+
|
|
21
|
+
if (isClassComponent)
|
|
22
|
+
return React.createElement(component as React.ComponentType<TProps>, props as any)
|
|
23
|
+
|
|
24
|
+
// For function components and render functions, call directly
|
|
25
|
+
// Using createElement with inline arrow functions causes unmount/remount
|
|
26
|
+
// when function reference changes, this matches v2.x behavior
|
|
27
|
+
return (component as (props: TProps) => React.ReactNode)(props)
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
// If it's neither, return it as-is
|
package/CHANGELOG.md
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [3.2.0] - 2025-11-25
|
|
4
|
-
|
|
5
|
-
### ✨ Features
|
|
6
|
-
- **Custom Link Parser**: Replaced `react-native-autolink` dependency with custom link parser implementation for better control and performance
|
|
7
|
-
- Removed external dependency on `react-native-autolink`
|
|
8
|
-
- Improved link parsing with custom implementation in `linkParser.tsx`
|
|
9
|
-
- Updated `MessageText` component to use new parser
|
|
10
|
-
- Enhanced links example in example app
|
|
11
|
-
|
|
12
|
-
### 🐛 Bug Fixes
|
|
13
|
-
- Adjusted message bubble styles for better rendering
|
|
14
|
-
- Updated test snapshots to reflect parser changes
|
|
15
|
-
|
|
16
|
-
## [3.1.5] - 2025-11-25
|
|
17
|
-
|
|
18
|
-
### ✨ Features
|
|
19
|
-
- **Color Scheme Support**: Added `colorScheme` prop to `GiftedChat` component
|
|
20
|
-
- New `useColorScheme` hook for consistent color scheme handling
|
|
21
|
-
- Automatically adapts UI elements (Composer, InputToolbar, Send) based on color scheme
|
|
22
|
-
- Added comprehensive tests for color scheme functionality
|
|
23
|
-
|
|
24
|
-
### 📝 Documentation
|
|
25
|
-
- Updated README with `colorScheme` prop documentation
|
|
26
|
-
|
|
27
|
-
## [3.1.4] - 2025-11-25
|
|
28
|
-
|
|
29
|
-
### 🐛 Bug Fixes
|
|
30
|
-
- Added left padding to `TextInput` when no accessory is present for better visual alignment
|
|
31
|
-
- Adjusted input toolbar styles for improved layout
|
|
32
|
-
|
|
33
|
-
## [3.1.3] - 2025-11-25
|
|
34
|
-
|
|
35
|
-
### 🔧 Improvements
|
|
36
|
-
- Removed unused imports for cleaner codebase
|
|
37
|
-
|
|
38
|
-
## [3.1.2] - 2025-11-24
|
|
39
|
-
|
|
40
|
-
### 🐛 Bug Fixes
|
|
41
|
-
- Fixed message bubble styles for small messages
|
|
42
|
-
- Improved rendering of compact message content
|
|
43
|
-
|
|
44
|
-
### 🧪 Testing
|
|
45
|
-
- Updated test snapshots
|
|
46
|
-
|
|
47
|
-
## [3.1.1] - 2025-11-24
|
|
48
|
-
|
|
49
|
-
### 🐛 Bug Fixes
|
|
50
|
-
- Fixed Bubble component styles for better message rendering
|
|
51
|
-
- Corrected style inconsistencies in message bubbles
|
|
52
|
-
|
|
53
|
-
### 🧪 Testing
|
|
54
|
-
- Updated test snapshots to reflect style fixes
|
|
55
|
-
|
|
56
|
-
## [3.1.0] - 2025-11-24
|
|
57
|
-
|
|
58
|
-
### 🔧 Improvements
|
|
59
|
-
- Refactored component styles for better maintainability
|
|
60
|
-
- Updated Expo Snack example with latest changes
|
|
61
|
-
|
|
62
|
-
### 🧪 Testing
|
|
63
|
-
- Updated test snapshots
|
|
64
|
-
|
|
65
|
-
## [3.0.1] - 2025-11-24
|
|
66
|
-
|
|
67
|
-
### 🐛 Bug Fixes
|
|
68
|
-
- Fixed Composer auto-resize height behavior on web platform
|
|
69
|
-
|
|
70
|
-
### 🧪 Testing
|
|
71
|
-
- Updated test snapshots
|
|
72
|
-
|
|
73
|
-
## [3.0.0] - 2025-11-23
|
|
74
|
-
|
|
75
|
-
This is a major release with significant breaking changes, new features, and improvements. The library has been completely rewritten in TypeScript with improved type safety, better keyboard handling, and enhanced customization options.
|
|
76
|
-
|
|
77
|
-
### 🚨 Breaking Changes
|
|
78
|
-
|
|
79
|
-
#### Renamed Props (GiftedChat)
|
|
80
|
-
- `onInputTextChanged` → moved to `textInputProps.onChangeText` (follows React Native naming pattern)
|
|
81
|
-
- `alwaysShowSend` → `isSendButtonAlwaysVisible` (consistent boolean naming convention)
|
|
82
|
-
- `onPress` → `onPressMessage` (more specific naming)
|
|
83
|
-
- `onLongPress` → `onLongPressMessage` (more specific naming)
|
|
84
|
-
- `options` → `actions` (better semantic naming, different type signature)
|
|
85
|
-
- `optionTintColor` → `actionSheetOptionTintColor` (clearer naming)
|
|
86
|
-
- `renderUsernameOnMessage` → `isUsernameVisible` (consistent boolean naming)
|
|
87
|
-
- `showUserAvatar` → `isUserAvatarVisible` (consistent boolean naming)
|
|
88
|
-
- `showAvatarForEveryMessage` → `isAvatarVisibleForEveryMessage` (consistent boolean naming)
|
|
89
|
-
- `renderAvatarOnTop` → `isAvatarOnTop` (consistent boolean naming)
|
|
90
|
-
- `focusOnInputWhenOpeningKeyboard` → `shouldFocusInputOnKeyboardOpen` (consistent boolean naming)
|
|
91
|
-
- `messageContainerRef` → `messagesContainerRef` (typo fix)
|
|
92
|
-
- `alignTop` → `isAlignedTop` (consistent boolean naming)
|
|
93
|
-
- `inverted` → `isInverted` (consistent boolean naming)
|
|
94
|
-
|
|
95
|
-
#### Removed Props (GiftedChat)
|
|
96
|
-
- `bottomOffset` - use `keyboardAvoidingViewProps.keyboardVerticalOffset` instead
|
|
97
|
-
- `disableKeyboardController` - removed keyboard controller configuration
|
|
98
|
-
- `isKeyboardInternallyHandled` - keyboard handling now always uses react-native-keyboard-controller
|
|
99
|
-
- `lightboxProps` - custom Modal implementation replaced react-native-lightbox-v2
|
|
100
|
-
- `placeholder` - moved to `textInputProps.placeholder`
|
|
101
|
-
- `disableComposer` - moved to `textInputProps.editable={false}`
|
|
102
|
-
- `keyboardShouldPersistTaps` - moved to `listProps.keyboardShouldPersistTaps`
|
|
103
|
-
- `maxInputLength` - moved to `textInputProps.maxLength`
|
|
104
|
-
- `extraData` - moved to `listProps.extraData`
|
|
105
|
-
- `infiniteScroll` - use `loadEarlierMessagesProps.isInfiniteScrollEnabled` instead
|
|
106
|
-
- `parsePatterns` - removed, automatic link parsing improved
|
|
107
|
-
|
|
108
|
-
#### Props Moved to MessagesContainer (via spreading)
|
|
109
|
-
These props moved from `GiftedChatProps` to `MessagesContainerProps` but are still accessible on `GiftedChat` via prop spreading:
|
|
110
|
-
- `messages` - now in MessagesContainerProps
|
|
111
|
-
- `isTyping` - now in MessagesContainerProps (via TypingIndicatorProps)
|
|
112
|
-
- `loadEarlier` → `loadEarlierMessagesProps.isAvailable`
|
|
113
|
-
- `isLoadingEarlier` → `loadEarlierMessagesProps.isLoading`
|
|
114
|
-
- `onLoadEarlier` → `loadEarlierMessagesProps.onPress`
|
|
115
|
-
- `renderLoadEarlier` - now in MessagesContainerProps
|
|
116
|
-
- `renderDay` - now in MessagesContainerProps
|
|
117
|
-
- `renderMessage` - now in MessagesContainerProps
|
|
118
|
-
- `renderFooter` - now in MessagesContainerProps
|
|
119
|
-
- `renderChatEmpty` - now in MessagesContainerProps
|
|
120
|
-
- `scrollToBottomStyle` - now in MessagesContainerProps
|
|
121
|
-
- `isScrollToBottomEnabled` - now in MessagesContainerProps
|
|
122
|
-
- `scrollToBottomComponent` - now in MessagesContainerProps
|
|
123
|
-
- `onQuickReply` - now in MessagesContainerProps
|
|
124
|
-
- `listViewProps` → `listProps` (renamed in MessagesContainerProps)
|
|
125
|
-
|
|
126
|
-
#### Type Signature Changes
|
|
127
|
-
- `options`: changed from `{ [key: string]: () => void }` to `Array<{ title: string, action: () => void }>`
|
|
128
|
-
- `textInputProps`: changed from `object` to `Partial<React.ComponentProps<typeof TextInput>>`
|
|
129
|
-
- `renderInputToolbar`: now accepts `React.ComponentType | React.ReactElement | function | null` (can be component, element, function, or null)
|
|
130
|
-
- All callback props now use arrow function syntax instead of function syntax for better type inference
|
|
131
|
-
|
|
132
|
-
#### Dependency Changes
|
|
133
|
-
- Removed `react-native-lightbox-v2` (replaced with custom Modal implementation)
|
|
134
|
-
- Removed `react-native-iphone-x-helper` (deprecated)
|
|
135
|
-
- Removed `react-native-keyboard-controller` as direct dependency
|
|
136
|
-
- Added `react-native-keyboard-controller` as peer dependency (>=1.0.0)
|
|
137
|
-
- Added `react-native-gesture-handler` as peer dependency (>=2.0.0)
|
|
138
|
-
- Added `react-native-reanimated` support for v3 & v4
|
|
139
|
-
- Added `react-native-safe-area-context` as peer dependency (>=5.0.0)
|
|
140
|
-
|
|
141
|
-
### ✨ New Features
|
|
142
|
-
|
|
143
|
-
#### TypeScript Migration
|
|
144
|
-
- Complete conversion from JavaScript to TypeScript/TSX
|
|
145
|
-
- Improved type safety and IntelliSense support
|
|
146
|
-
- Better type definitions for all components and props
|
|
147
|
-
- Refactored types to arrow functions for better readability
|
|
148
|
-
|
|
149
|
-
#### Keyboard Handling
|
|
150
|
-
- New `keyboardTopToolbarHeight` prop for better keyboard customization
|
|
151
|
-
- New `keyboardAvoidingViewProps` to pass props to KeyboardAvoidingView from react-native-keyboard-controller
|
|
152
|
-
- Improved keyboard behavior and offset handling
|
|
153
|
-
- Consolidated keyboard configuration (removed individual keyboard props in favor of `keyboardAvoidingViewProps`)
|
|
154
|
-
- Fixed auto-grow text input behavior
|
|
155
|
-
- Better keyboard open/close transitions
|
|
156
|
-
- New `OverKeyboardView` component for MessageImage to keep keyboard open
|
|
157
|
-
|
|
158
|
-
#### Message Rendering
|
|
159
|
-
- `isDayAnimationEnabled` prop to control day separator animations
|
|
160
|
-
- Support for passing custom components in render functions
|
|
161
|
-
- Improved message parsing with better link detection
|
|
162
|
-
- Parse links in system messages (fixes #2105)
|
|
163
|
-
- Better phone number parsing with custom matchers support
|
|
164
|
-
- Improved URL parsing (email, phone, URL detection)
|
|
165
|
-
|
|
166
|
-
#### UI & Styling
|
|
167
|
-
- Dark theme support in example app
|
|
168
|
-
- Safe area provider included in library
|
|
169
|
-
- Improved LoadEarlier messages logic
|
|
170
|
-
- Better themed styles implementation
|
|
171
|
-
- Fixed press animation for TouchableOpacity
|
|
172
|
-
- Replaced deprecated `TouchableWithoutFeedback` with `Pressable`
|
|
173
|
-
- Better scroll to bottom button behavior on Android
|
|
174
|
-
|
|
175
|
-
#### Image Viewing
|
|
176
|
-
- Custom Modal implementation replacing react-native-lightbox-v2
|
|
177
|
-
- Better image viewing experience with proper insets handling
|
|
178
|
-
- Improved MessageImage component
|
|
179
|
-
|
|
180
|
-
#### Accessibility & UX
|
|
181
|
-
- `renderTicks` prop for message status indicators
|
|
182
|
-
- Better scroll to bottom wrapper visibility handling
|
|
183
|
-
- `useCallbackThrottled` for improved scroll performance
|
|
184
|
-
- Allow passing children to SystemMessage
|
|
185
|
-
- Improved load earlier messages functionality
|
|
186
|
-
|
|
187
|
-
### 🐛 Bug Fixes
|
|
188
|
-
|
|
189
|
-
- Fixed duplicate paragraph tags in README
|
|
190
|
-
- Fixed scroll to bottom when `isScrollToBottomEnabled=false` (#2652)
|
|
191
|
-
- Fixed TypeScript type inconsistencies and ESLint errors (#2653)
|
|
192
|
-
- Fixed automatic scroll to bottom issues (#2630, #2621, #2644)
|
|
193
|
-
- Fixed DayAnimated test import and added proper test coverage for renderDay prop
|
|
194
|
-
- Fixed not passed `isDayAnimationEnabled` prop
|
|
195
|
-
- Fixed MessageContainer scroll to bottom press on Android
|
|
196
|
-
- Fixed safer change ScrollToBottomWrapper visibility
|
|
197
|
-
- Fixed dependency cycles in imports
|
|
198
|
-
- Fixed MessageText container style
|
|
199
|
-
- Fixed reanimated issue in MessageContainer
|
|
200
|
-
- Fixed construct messages on send in example
|
|
201
|
-
- Fixed web support in example
|
|
202
|
-
- Fixed #2659 (memoization issues)
|
|
203
|
-
- Fixed #2640 (various bug fixes)
|
|
204
|
-
- Fixed show location in example
|
|
205
|
-
- Fixed errors in keyboard handling
|
|
206
|
-
- Fixed load earlier messages functionality
|
|
207
|
-
- Fixed Bubble type parameter to re-enable generics on message prop (#2639)
|
|
208
|
-
- Fixed listViewProps typing with Partial<FlatListProps> (#2628)
|
|
209
|
-
- Fixed MessageContainer to add renderDay prop and insert DayAnimated Component (#2632)
|
|
210
|
-
- Fixed dateFormatCalendar default value in README
|
|
211
|
-
|
|
212
|
-
### 🔧 Improvements
|
|
213
|
-
|
|
214
|
-
#### Performance
|
|
215
|
-
- Memoized values & functions for better performance
|
|
216
|
-
- Better scroll performance with throttled callbacks
|
|
217
|
-
- Optimized re-renders
|
|
218
|
-
|
|
219
|
-
#### Code Quality
|
|
220
|
-
- Added ESLint with import sorting
|
|
221
|
-
- Fixed all examples with ESLint
|
|
222
|
-
- Improved code structure and organization
|
|
223
|
-
- Better error handling
|
|
224
|
-
- Cleaner prop passing and component structure
|
|
225
|
-
|
|
226
|
-
#### Testing
|
|
227
|
-
- All tests converted to TypeScript
|
|
228
|
-
- Updated snapshots for new components
|
|
229
|
-
- Run tests in correct timezone (Europe/Paris)
|
|
230
|
-
- Improved test coverage
|
|
231
|
-
- Added comprehensive copilot instructions with validated commands
|
|
232
|
-
|
|
233
|
-
#### Documentation
|
|
234
|
-
- Improved README structure and formatting
|
|
235
|
-
- Better prop documentation and grouping
|
|
236
|
-
- Added matchers example
|
|
237
|
-
- Added working Expo Snack link
|
|
238
|
-
- Better feature documentation
|
|
239
|
-
- Added maintainer section
|
|
240
|
-
- Improved previews and images
|
|
241
|
-
- Added export documentation
|
|
242
|
-
- Fixed formatting issues and typos
|
|
243
|
-
- Better keyboard props documentation
|
|
244
|
-
|
|
245
|
-
#### Example App
|
|
246
|
-
- Updated to latest React Native and Expo
|
|
247
|
-
- Added tabs with different chat examples
|
|
248
|
-
- Added working link to Expo Snack
|
|
249
|
-
- Better example organization
|
|
250
|
-
- Added dark theme support
|
|
251
|
-
- Removed padding from bottom of toolbar
|
|
252
|
-
- Added custom phone matcher example
|
|
253
|
-
- Switch to dev build in README
|
|
254
|
-
- Android: transparent navigation & status bars by default
|
|
255
|
-
- Better project structure with multiple example types
|
|
256
|
-
|
|
257
|
-
#### Build & Development
|
|
258
|
-
- Better dependency management
|
|
259
|
-
- Updated to Node.js >= 20
|
|
260
|
-
- Yarn 1.22.22+ as package manager
|
|
261
|
-
- Added stale workflow for issue management
|
|
262
|
-
- Script to rebuild native dependencies
|
|
263
|
-
- Improved local development setup
|
|
264
|
-
|
|
265
|
-
### 📦 Dependencies
|
|
266
|
-
|
|
267
|
-
#### Added
|
|
268
|
-
- `@expo/react-native-action-sheet`: ^4.1.1
|
|
269
|
-
- `@types/lodash.isequal`: ^4.5.8
|
|
270
|
-
- `dayjs`: ^1.11.19
|
|
271
|
-
- `lodash.isequal`: ^4.5.0
|
|
272
|
-
- `react-native-zoom-reanimated`: ^1.4.10
|
|
273
|
-
|
|
274
|
-
#### Peer Dependencies (now required)
|
|
275
|
-
- `react`: >=18.0.0
|
|
276
|
-
- `react-native`: *
|
|
277
|
-
- `react-native-gesture-handler`: >=2.0.0
|
|
278
|
-
- `react-native-keyboard-controller`: >=1.0.0
|
|
279
|
-
- `react-native-reanimated`: >=3.0.0 || ^4.0.0
|
|
280
|
-
- `react-native-safe-area-context`: >=5.0.0
|
|
281
|
-
|
|
282
|
-
### 🔄 Migration Guide
|
|
283
|
-
|
|
284
|
-
#### Update Prop Names
|
|
285
|
-
```javascript
|
|
286
|
-
// Before (v2.8.1)
|
|
287
|
-
<GiftedChat
|
|
288
|
-
messages={messages}
|
|
289
|
-
onInputTextChanged={handleTextChange}
|
|
290
|
-
alwaysShowSend={true}
|
|
291
|
-
onPress={handlePress}
|
|
292
|
-
onLongPress={handleLongPress}
|
|
293
|
-
options={{ 'Option 1': action1, 'Option 2': action2 }}
|
|
294
|
-
optionTintColor="#007AFF"
|
|
295
|
-
bottomOffset={100}
|
|
296
|
-
placeholder="Type a message..."
|
|
297
|
-
maxInputLength={1000}
|
|
298
|
-
renderUsernameOnMessage={true}
|
|
299
|
-
showUserAvatar={false}
|
|
300
|
-
showAvatarForEveryMessage={false}
|
|
301
|
-
renderAvatarOnTop={false}
|
|
302
|
-
alignTop={false}
|
|
303
|
-
inverted={true}
|
|
304
|
-
loadEarlier={true}
|
|
305
|
-
isLoadingEarlier={false}
|
|
306
|
-
onLoadEarlier={handleLoadEarlier}
|
|
307
|
-
/>
|
|
308
|
-
|
|
309
|
-
// After (v3.0.0)
|
|
310
|
-
<GiftedChat
|
|
311
|
-
messages={messages}
|
|
312
|
-
textInputProps={{
|
|
313
|
-
onChangeText: handleTextChange,
|
|
314
|
-
placeholder: "Type a message...",
|
|
315
|
-
maxLength: 1000
|
|
316
|
-
}}
|
|
317
|
-
isSendButtonAlwaysVisible={true}
|
|
318
|
-
onPressMessage={handlePress}
|
|
319
|
-
onLongPressMessage={handleLongPress}
|
|
320
|
-
actions={[
|
|
321
|
-
{ title: 'Option 1', action: action1 },
|
|
322
|
-
{ title: 'Option 2', action: action2 }
|
|
323
|
-
]}
|
|
324
|
-
actionSheetOptionTintColor="#007AFF"
|
|
325
|
-
keyboardAvoidingViewProps={{ keyboardVerticalOffset: 100 }}
|
|
326
|
-
isUsernameVisible={true}
|
|
327
|
-
isUserAvatarVisible={false}
|
|
328
|
-
isAvatarVisibleForEveryMessage={false}
|
|
329
|
-
isAvatarOnTop={false}
|
|
330
|
-
isAlignedTop={false}
|
|
331
|
-
isInverted={true}
|
|
332
|
-
loadEarlierMessagesProps={{
|
|
333
|
-
isAvailable: true,
|
|
334
|
-
isLoading: false,
|
|
335
|
-
onPress: handleLoadEarlier
|
|
336
|
-
}}
|
|
337
|
-
/>
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
#### Install Peer Dependencies
|
|
341
|
-
```bash
|
|
342
|
-
npm install react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
|
|
343
|
-
# or
|
|
344
|
-
yarn add react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
#### Update Image Lightbox
|
|
348
|
-
The library now uses a custom Modal implementation instead of react-native-lightbox-v2. If you were customizing the lightbox, you'll need to update your customization approach.
|
|
349
|
-
|
|
350
|
-
### 📝 Notes
|
|
351
|
-
|
|
352
|
-
- This version includes 170+ commits since v2.8.1
|
|
353
|
-
- Full TypeScript support with improved type definitions
|
|
354
|
-
- Better React Native compatibility (tested with RN 0.81.5)
|
|
355
|
-
- Improved React 19 support
|
|
356
|
-
- Better Expo integration
|
|
357
|
-
|
|
358
|
-
### 👥 Contributors
|
|
359
|
-
|
|
360
|
-
Special thanks to all contributors who made this release possible, including fixes and improvements from the community.
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
For detailed commit history, see: https://github.com/FaridSafi/react-native-gifted-chat/compare/2.8.1...3.0.0
|