react-native-gifted-chat 3.3.2 → 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 +30 -2
- 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 +8 -7
- 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 -397
- package/src/GiftedChat/styles.ts +0 -13
- 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 -184
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +0 -123
- 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 -203
- 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 -349
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +0 -148
- 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 -139
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.3.2] - 2026-01-22
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes
|
|
6
|
+
- Fixed `React.memo` and `React.forwardRef` components not rendering correctly when passed as render props
|
|
7
|
+
- `renderComponentOrElement` now properly handles components with `$$typeof` property
|
|
8
|
+
- Fixed layout jump on initial render - content now renders with `opacity: 0` until initialized
|
|
9
|
+
- Fixed keyboard vertical offset documentation and examples
|
|
10
|
+
|
|
11
|
+
### 🔧 Improvements
|
|
12
|
+
- Updated `keyboardVerticalOffset` documentation in README with clearer explanation
|
|
13
|
+
- Added `hidden` style for smoother initial render transitions
|
|
14
|
+
|
|
15
|
+
### 📝 Documentation
|
|
16
|
+
- Improved `keyboardVerticalOffset` section explaining that it equals distance from screen top to container top
|
|
17
|
+
- Added recommendation to use `useHeaderHeight()` from `@react-navigation/elements`
|
|
18
|
+
|
|
19
|
+
## [3.3.0] - 2026-01-21
|
|
20
|
+
|
|
21
|
+
### ✨ Features
|
|
22
|
+
- **Swipe to Reply**: New swipe-to-reply functionality using `ReanimatedSwipeable` (based on #2692)
|
|
23
|
+
- Replaced deprecated `Swipeable` with `ReanimatedSwipeable` from react-native-gesture-handler
|
|
24
|
+
- Added `reply` prop to `GiftedChat` with grouped configuration options
|
|
25
|
+
- Swipe direction support: `'left'` (swipe left, icon on right) or `'right'` (swipe right, icon on left)
|
|
26
|
+
- Custom swipe action rendering via `renderAction`
|
|
27
|
+
- Built-in animated `ReplyIcon` component
|
|
28
|
+
- `ReplyPreview` component with smooth enter/exit animations
|
|
29
|
+
- Reply message display in `Bubble` component via `messageReply` prop
|
|
30
|
+
- **New Props**:
|
|
31
|
+
- `scrollToBottomContentStyle` - style for scroll to bottom button content
|
|
32
|
+
|
|
33
|
+
### 🐛 Bug Fixes
|
|
34
|
+
- Fixed #2702 - typing issues
|
|
35
|
+
- Fixed #2708 - component issues
|
|
36
|
+
- Fixed #2607 - edge case handling
|
|
37
|
+
- Fixed #2701 - rendering issues
|
|
38
|
+
- Fixed #2691 - prop handling
|
|
39
|
+
- Fixed #2688 - style issues
|
|
40
|
+
- Fixed #2687 - component behavior
|
|
41
|
+
- Fixed #2618 - scroll issues
|
|
42
|
+
- Fixed #2677, #2682, #2602 - multiple fixes
|
|
43
|
+
- Fixed #2684, #2686 - component issues
|
|
44
|
+
- Fixed `onScroll` type definition
|
|
45
|
+
- Fixed messages padding
|
|
46
|
+
- Fixed SystemMessage styles
|
|
47
|
+
- Added missing worklets for animations
|
|
48
|
+
- Removed `ts-expect-error` for `requestAnimationFrame` (now properly typed for React Native)
|
|
49
|
+
- Fixed two typing issues (#2698)
|
|
50
|
+
|
|
51
|
+
### 🔧 Improvements
|
|
52
|
+
- Grouped reply-related props into `ReplyProps` interface for cleaner API
|
|
53
|
+
- Added `SwipeToReplyProps` for Message-level swipe configuration
|
|
54
|
+
- Added `BubbleReplyProps` for Bubble-level reply message styling
|
|
55
|
+
- Added example app to lint command with proper path alias support
|
|
56
|
+
- Improved reply animations (enter/exit transitions)
|
|
57
|
+
- Changes from #2705
|
|
58
|
+
|
|
59
|
+
### 📝 Documentation
|
|
60
|
+
- Updated README with swipe-to-reply feature documentation and examples
|
|
61
|
+
- Updated license link
|
|
62
|
+
- Added reply message implementation example (#2690)
|
|
63
|
+
|
|
64
|
+
### 🧪 Testing
|
|
65
|
+
- Updated test snapshots
|
|
66
|
+
- Added tests for `MessageReply` component
|
|
67
|
+
- Added tests for `ReplyPreview` component
|
|
68
|
+
|
|
69
|
+
## [3.2.3] - 2025-12-XX
|
|
70
|
+
|
|
71
|
+
### 🐛 Bug Fixes
|
|
72
|
+
- Fixed `onScroll` type definition
|
|
73
|
+
|
|
74
|
+
## [3.2.0] - 2025-11-25
|
|
75
|
+
|
|
76
|
+
### ✨ Features
|
|
77
|
+
- **Custom Link Parser**: Replaced `react-native-autolink` dependency with custom link parser implementation for better control and performance
|
|
78
|
+
- Removed external dependency on `react-native-autolink`
|
|
79
|
+
- Improved link parsing with custom implementation in `linkParser.tsx`
|
|
80
|
+
- Updated `MessageText` component to use new parser
|
|
81
|
+
- Enhanced links example in example app
|
|
82
|
+
|
|
83
|
+
### 🐛 Bug Fixes
|
|
84
|
+
- Adjusted message bubble styles for better rendering
|
|
85
|
+
- Updated test snapshots to reflect parser changes
|
|
86
|
+
|
|
87
|
+
## [3.1.5] - 2025-11-25
|
|
88
|
+
|
|
89
|
+
### ✨ Features
|
|
90
|
+
- **Color Scheme Support**: Added `colorScheme` prop to `GiftedChat` component
|
|
91
|
+
- New `useColorScheme` hook for consistent color scheme handling
|
|
92
|
+
- Automatically adapts UI elements (Composer, InputToolbar, Send) based on color scheme
|
|
93
|
+
- Added comprehensive tests for color scheme functionality
|
|
94
|
+
|
|
95
|
+
### 📝 Documentation
|
|
96
|
+
- Updated README with `colorScheme` prop documentation
|
|
97
|
+
|
|
98
|
+
## [3.1.4] - 2025-11-25
|
|
99
|
+
|
|
100
|
+
### 🐛 Bug Fixes
|
|
101
|
+
- Added left padding to `TextInput` when no accessory is present for better visual alignment
|
|
102
|
+
- Adjusted input toolbar styles for improved layout
|
|
103
|
+
|
|
104
|
+
## [3.1.3] - 2025-11-25
|
|
105
|
+
|
|
106
|
+
### 🔧 Improvements
|
|
107
|
+
- Removed unused imports for cleaner codebase
|
|
108
|
+
|
|
109
|
+
## [3.1.2] - 2025-11-24
|
|
110
|
+
|
|
111
|
+
### 🐛 Bug Fixes
|
|
112
|
+
- Fixed message bubble styles for small messages
|
|
113
|
+
- Improved rendering of compact message content
|
|
114
|
+
|
|
115
|
+
### 🧪 Testing
|
|
116
|
+
- Updated test snapshots
|
|
117
|
+
|
|
118
|
+
## [3.1.1] - 2025-11-24
|
|
119
|
+
|
|
120
|
+
### 🐛 Bug Fixes
|
|
121
|
+
- Fixed Bubble component styles for better message rendering
|
|
122
|
+
- Corrected style inconsistencies in message bubbles
|
|
123
|
+
|
|
124
|
+
### 🧪 Testing
|
|
125
|
+
- Updated test snapshots to reflect style fixes
|
|
126
|
+
|
|
127
|
+
## [3.1.0] - 2025-11-24
|
|
128
|
+
|
|
129
|
+
### 🔧 Improvements
|
|
130
|
+
- Refactored component styles for better maintainability
|
|
131
|
+
- Updated Expo Snack example with latest changes
|
|
132
|
+
|
|
133
|
+
### 🧪 Testing
|
|
134
|
+
- Updated test snapshots
|
|
135
|
+
|
|
136
|
+
## [3.0.1] - 2025-11-24
|
|
137
|
+
|
|
138
|
+
### 🐛 Bug Fixes
|
|
139
|
+
- Fixed Composer auto-resize height behavior on web platform
|
|
140
|
+
|
|
141
|
+
### 🧪 Testing
|
|
142
|
+
- Updated test snapshots
|
|
143
|
+
|
|
144
|
+
## [3.0.0] - 2025-11-23
|
|
145
|
+
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
### 🚨 Breaking Changes
|
|
149
|
+
|
|
150
|
+
#### Renamed Props (GiftedChat)
|
|
151
|
+
- `onInputTextChanged` → moved to `textInputProps.onChangeText` (follows React Native naming pattern)
|
|
152
|
+
- `alwaysShowSend` → `isSendButtonAlwaysVisible` (consistent boolean naming convention)
|
|
153
|
+
- `onPress` → `onPressMessage` (more specific naming)
|
|
154
|
+
- `onLongPress` → `onLongPressMessage` (more specific naming)
|
|
155
|
+
- `options` → `actions` (better semantic naming, different type signature)
|
|
156
|
+
- `optionTintColor` → `actionSheetOptionTintColor` (clearer naming)
|
|
157
|
+
- `renderUsernameOnMessage` → `isUsernameVisible` (consistent boolean naming)
|
|
158
|
+
- `showUserAvatar` → `isUserAvatarVisible` (consistent boolean naming)
|
|
159
|
+
- `showAvatarForEveryMessage` → `isAvatarVisibleForEveryMessage` (consistent boolean naming)
|
|
160
|
+
- `renderAvatarOnTop` → `isAvatarOnTop` (consistent boolean naming)
|
|
161
|
+
- `focusOnInputWhenOpeningKeyboard` → `shouldFocusInputOnKeyboardOpen` (consistent boolean naming)
|
|
162
|
+
- `messageContainerRef` → `messagesContainerRef` (typo fix)
|
|
163
|
+
- `alignTop` → `isAlignedTop` (consistent boolean naming)
|
|
164
|
+
- `inverted` → `isInverted` (consistent boolean naming)
|
|
165
|
+
|
|
166
|
+
#### Removed Props (GiftedChat)
|
|
167
|
+
- `bottomOffset` - use `keyboardAvoidingViewProps.keyboardVerticalOffset` instead
|
|
168
|
+
- `disableKeyboardController` - removed keyboard controller configuration
|
|
169
|
+
- `isKeyboardInternallyHandled` - keyboard handling now always uses react-native-keyboard-controller
|
|
170
|
+
- `lightboxProps` - custom Modal implementation replaced react-native-lightbox-v2
|
|
171
|
+
- `placeholder` - moved to `textInputProps.placeholder`
|
|
172
|
+
- `disableComposer` - moved to `textInputProps.editable={false}`
|
|
173
|
+
- `keyboardShouldPersistTaps` - moved to `listProps.keyboardShouldPersistTaps`
|
|
174
|
+
- `maxInputLength` - moved to `textInputProps.maxLength`
|
|
175
|
+
- `extraData` - moved to `listProps.extraData`
|
|
176
|
+
- `infiniteScroll` - use `loadEarlierMessagesProps.isInfiniteScrollEnabled` instead
|
|
177
|
+
- `parsePatterns` - removed, automatic link parsing improved
|
|
178
|
+
|
|
179
|
+
#### Props Moved to MessagesContainer (via spreading)
|
|
180
|
+
These props moved from `GiftedChatProps` to `MessagesContainerProps` but are still accessible on `GiftedChat` via prop spreading:
|
|
181
|
+
- `messages` - now in MessagesContainerProps
|
|
182
|
+
- `isTyping` - now in MessagesContainerProps (via TypingIndicatorProps)
|
|
183
|
+
- `loadEarlier` → `loadEarlierMessagesProps.isAvailable`
|
|
184
|
+
- `isLoadingEarlier` → `loadEarlierMessagesProps.isLoading`
|
|
185
|
+
- `onLoadEarlier` → `loadEarlierMessagesProps.onPress`
|
|
186
|
+
- `renderLoadEarlier` - now in MessagesContainerProps
|
|
187
|
+
- `renderDay` - now in MessagesContainerProps
|
|
188
|
+
- `renderMessage` - now in MessagesContainerProps
|
|
189
|
+
- `renderFooter` - now in MessagesContainerProps
|
|
190
|
+
- `renderChatEmpty` - now in MessagesContainerProps
|
|
191
|
+
- `scrollToBottomStyle` - now in MessagesContainerProps
|
|
192
|
+
- `isScrollToBottomEnabled` - now in MessagesContainerProps
|
|
193
|
+
- `scrollToBottomComponent` - now in MessagesContainerProps
|
|
194
|
+
- `onQuickReply` - now in MessagesContainerProps
|
|
195
|
+
- `listViewProps` → `listProps` (renamed in MessagesContainerProps)
|
|
196
|
+
|
|
197
|
+
#### Type Signature Changes
|
|
198
|
+
- `options`: changed from `{ [key: string]: () => void }` to `Array<{ title: string, action: () => void }>`
|
|
199
|
+
- `textInputProps`: changed from `object` to `Partial<React.ComponentProps<typeof TextInput>>`
|
|
200
|
+
- `renderInputToolbar`: now accepts `React.ComponentType | React.ReactElement | function | null` (can be component, element, function, or null)
|
|
201
|
+
- All callback props now use arrow function syntax instead of function syntax for better type inference
|
|
202
|
+
|
|
203
|
+
#### Dependency Changes
|
|
204
|
+
- Removed `react-native-lightbox-v2` (replaced with custom Modal implementation)
|
|
205
|
+
- Removed `react-native-iphone-x-helper` (deprecated)
|
|
206
|
+
- Removed `react-native-keyboard-controller` as direct dependency
|
|
207
|
+
- Added `react-native-keyboard-controller` as peer dependency (>=1.0.0)
|
|
208
|
+
- Added `react-native-gesture-handler` as peer dependency (>=2.0.0)
|
|
209
|
+
- Added `react-native-reanimated` support for v3 & v4
|
|
210
|
+
- Added `react-native-safe-area-context` as peer dependency (>=5.0.0)
|
|
211
|
+
|
|
212
|
+
### ✨ New Features
|
|
213
|
+
|
|
214
|
+
#### TypeScript Migration
|
|
215
|
+
- Complete conversion from JavaScript to TypeScript/TSX
|
|
216
|
+
- Improved type safety and IntelliSense support
|
|
217
|
+
- Better type definitions for all components and props
|
|
218
|
+
- Refactored types to arrow functions for better readability
|
|
219
|
+
|
|
220
|
+
#### Keyboard Handling
|
|
221
|
+
- New `keyboardTopToolbarHeight` prop for better keyboard customization
|
|
222
|
+
- New `keyboardAvoidingViewProps` to pass props to KeyboardAvoidingView from react-native-keyboard-controller
|
|
223
|
+
- Improved keyboard behavior and offset handling
|
|
224
|
+
- Consolidated keyboard configuration (removed individual keyboard props in favor of `keyboardAvoidingViewProps`)
|
|
225
|
+
- Fixed auto-grow text input behavior
|
|
226
|
+
- Better keyboard open/close transitions
|
|
227
|
+
- New `OverKeyboardView` component for MessageImage to keep keyboard open
|
|
228
|
+
|
|
229
|
+
#### Message Rendering
|
|
230
|
+
- `isDayAnimationEnabled` prop to control day separator animations
|
|
231
|
+
- Support for passing custom components in render functions
|
|
232
|
+
- Improved message parsing with better link detection
|
|
233
|
+
- Parse links in system messages (fixes #2105)
|
|
234
|
+
- Better phone number parsing with custom matchers support
|
|
235
|
+
- Improved URL parsing (email, phone, URL detection)
|
|
236
|
+
|
|
237
|
+
#### UI & Styling
|
|
238
|
+
- Dark theme support in example app
|
|
239
|
+
- Safe area provider included in library
|
|
240
|
+
- Improved LoadEarlier messages logic
|
|
241
|
+
- Better themed styles implementation
|
|
242
|
+
- Fixed press animation for TouchableOpacity
|
|
243
|
+
- Replaced deprecated `TouchableWithoutFeedback` with `Pressable`
|
|
244
|
+
- Better scroll to bottom button behavior on Android
|
|
245
|
+
|
|
246
|
+
#### Image Viewing
|
|
247
|
+
- Custom Modal implementation replacing react-native-lightbox-v2
|
|
248
|
+
- Better image viewing experience with proper insets handling
|
|
249
|
+
- Improved MessageImage component
|
|
250
|
+
|
|
251
|
+
#### Accessibility & UX
|
|
252
|
+
- `renderTicks` prop for message status indicators
|
|
253
|
+
- Better scroll to bottom wrapper visibility handling
|
|
254
|
+
- `useCallbackThrottled` for improved scroll performance
|
|
255
|
+
- Allow passing children to SystemMessage
|
|
256
|
+
- Improved load earlier messages functionality
|
|
257
|
+
|
|
258
|
+
### 🐛 Bug Fixes
|
|
259
|
+
|
|
260
|
+
- Fixed duplicate paragraph tags in README
|
|
261
|
+
- Fixed scroll to bottom when `isScrollToBottomEnabled=false` (#2652)
|
|
262
|
+
- Fixed TypeScript type inconsistencies and ESLint errors (#2653)
|
|
263
|
+
- Fixed automatic scroll to bottom issues (#2630, #2621, #2644)
|
|
264
|
+
- Fixed DayAnimated test import and added proper test coverage for renderDay prop
|
|
265
|
+
- Fixed not passed `isDayAnimationEnabled` prop
|
|
266
|
+
- Fixed MessageContainer scroll to bottom press on Android
|
|
267
|
+
- Fixed safer change ScrollToBottomWrapper visibility
|
|
268
|
+
- Fixed dependency cycles in imports
|
|
269
|
+
- Fixed MessageText container style
|
|
270
|
+
- Fixed reanimated issue in MessageContainer
|
|
271
|
+
- Fixed construct messages on send in example
|
|
272
|
+
- Fixed web support in example
|
|
273
|
+
- Fixed #2659 (memoization issues)
|
|
274
|
+
- Fixed #2640 (various bug fixes)
|
|
275
|
+
- Fixed show location in example
|
|
276
|
+
- Fixed errors in keyboard handling
|
|
277
|
+
- Fixed load earlier messages functionality
|
|
278
|
+
- Fixed Bubble type parameter to re-enable generics on message prop (#2639)
|
|
279
|
+
- Fixed listViewProps typing with Partial<FlatListProps> (#2628)
|
|
280
|
+
- Fixed MessageContainer to add renderDay prop and insert DayAnimated Component (#2632)
|
|
281
|
+
- Fixed dateFormatCalendar default value in README
|
|
282
|
+
|
|
283
|
+
### 🔧 Improvements
|
|
284
|
+
|
|
285
|
+
#### Performance
|
|
286
|
+
- Memoized values & functions for better performance
|
|
287
|
+
- Better scroll performance with throttled callbacks
|
|
288
|
+
- Optimized re-renders
|
|
289
|
+
|
|
290
|
+
#### Code Quality
|
|
291
|
+
- Added ESLint with import sorting
|
|
292
|
+
- Fixed all examples with ESLint
|
|
293
|
+
- Improved code structure and organization
|
|
294
|
+
- Better error handling
|
|
295
|
+
- Cleaner prop passing and component structure
|
|
296
|
+
|
|
297
|
+
#### Testing
|
|
298
|
+
- All tests converted to TypeScript
|
|
299
|
+
- Updated snapshots for new components
|
|
300
|
+
- Run tests in correct timezone (Europe/Paris)
|
|
301
|
+
- Improved test coverage
|
|
302
|
+
- Added comprehensive copilot instructions with validated commands
|
|
303
|
+
|
|
304
|
+
#### Documentation
|
|
305
|
+
- Improved README structure and formatting
|
|
306
|
+
- Better prop documentation and grouping
|
|
307
|
+
- Added matchers example
|
|
308
|
+
- Added working Expo Snack link
|
|
309
|
+
- Better feature documentation
|
|
310
|
+
- Added maintainer section
|
|
311
|
+
- Improved previews and images
|
|
312
|
+
- Added export documentation
|
|
313
|
+
- Fixed formatting issues and typos
|
|
314
|
+
- Better keyboard props documentation
|
|
315
|
+
|
|
316
|
+
#### Example App
|
|
317
|
+
- Updated to latest React Native and Expo
|
|
318
|
+
- Added tabs with different chat examples
|
|
319
|
+
- Added working link to Expo Snack
|
|
320
|
+
- Better example organization
|
|
321
|
+
- Added dark theme support
|
|
322
|
+
- Removed padding from bottom of toolbar
|
|
323
|
+
- Added custom phone matcher example
|
|
324
|
+
- Switch to dev build in README
|
|
325
|
+
- Android: transparent navigation & status bars by default
|
|
326
|
+
- Better project structure with multiple example types
|
|
327
|
+
|
|
328
|
+
#### Build & Development
|
|
329
|
+
- Better dependency management
|
|
330
|
+
- Updated to Node.js >= 20
|
|
331
|
+
- Yarn 1.22.22+ as package manager
|
|
332
|
+
- Added stale workflow for issue management
|
|
333
|
+
- Script to rebuild native dependencies
|
|
334
|
+
- Improved local development setup
|
|
335
|
+
|
|
336
|
+
### 📦 Dependencies
|
|
337
|
+
|
|
338
|
+
#### Added
|
|
339
|
+
- `@expo/react-native-action-sheet`: ^4.1.1
|
|
340
|
+
- `@types/lodash.isequal`: ^4.5.8
|
|
341
|
+
- `dayjs`: ^1.11.19
|
|
342
|
+
- `lodash.isequal`: ^4.5.0
|
|
343
|
+
- `react-native-zoom-reanimated`: ^1.4.10
|
|
344
|
+
|
|
345
|
+
#### Peer Dependencies (now required)
|
|
346
|
+
- `react`: >=18.0.0
|
|
347
|
+
- `react-native`: *
|
|
348
|
+
- `react-native-gesture-handler`: >=2.0.0
|
|
349
|
+
- `react-native-keyboard-controller`: >=1.0.0
|
|
350
|
+
- `react-native-reanimated`: >=3.0.0 || ^4.0.0
|
|
351
|
+
- `react-native-safe-area-context`: >=5.0.0
|
|
352
|
+
|
|
353
|
+
### 🔄 Migration Guide
|
|
354
|
+
|
|
355
|
+
#### Update Prop Names
|
|
356
|
+
```javascript
|
|
357
|
+
// Before (v2.8.1)
|
|
358
|
+
<GiftedChat
|
|
359
|
+
messages={messages}
|
|
360
|
+
onInputTextChanged={handleTextChange}
|
|
361
|
+
alwaysShowSend={true}
|
|
362
|
+
onPress={handlePress}
|
|
363
|
+
onLongPress={handleLongPress}
|
|
364
|
+
options={{ 'Option 1': action1, 'Option 2': action2 }}
|
|
365
|
+
optionTintColor="#007AFF"
|
|
366
|
+
bottomOffset={100}
|
|
367
|
+
placeholder="Type a message..."
|
|
368
|
+
maxInputLength={1000}
|
|
369
|
+
renderUsernameOnMessage={true}
|
|
370
|
+
showUserAvatar={false}
|
|
371
|
+
showAvatarForEveryMessage={false}
|
|
372
|
+
renderAvatarOnTop={false}
|
|
373
|
+
alignTop={false}
|
|
374
|
+
inverted={true}
|
|
375
|
+
loadEarlier={true}
|
|
376
|
+
isLoadingEarlier={false}
|
|
377
|
+
onLoadEarlier={handleLoadEarlier}
|
|
378
|
+
/>
|
|
379
|
+
|
|
380
|
+
// After (v3.0.0)
|
|
381
|
+
<GiftedChat
|
|
382
|
+
messages={messages}
|
|
383
|
+
textInputProps={{
|
|
384
|
+
onChangeText: handleTextChange,
|
|
385
|
+
placeholder: "Type a message...",
|
|
386
|
+
maxLength: 1000
|
|
387
|
+
}}
|
|
388
|
+
isSendButtonAlwaysVisible={true}
|
|
389
|
+
onPressMessage={handlePress}
|
|
390
|
+
onLongPressMessage={handleLongPress}
|
|
391
|
+
actions={[
|
|
392
|
+
{ title: 'Option 1', action: action1 },
|
|
393
|
+
{ title: 'Option 2', action: action2 }
|
|
394
|
+
]}
|
|
395
|
+
actionSheetOptionTintColor="#007AFF"
|
|
396
|
+
keyboardAvoidingViewProps={{ keyboardVerticalOffset: 100 }}
|
|
397
|
+
isUsernameVisible={true}
|
|
398
|
+
isUserAvatarVisible={false}
|
|
399
|
+
isAvatarVisibleForEveryMessage={false}
|
|
400
|
+
isAvatarOnTop={false}
|
|
401
|
+
isAlignedTop={false}
|
|
402
|
+
isInverted={true}
|
|
403
|
+
loadEarlierMessagesProps={{
|
|
404
|
+
isAvailable: true,
|
|
405
|
+
isLoading: false,
|
|
406
|
+
onPress: handleLoadEarlier
|
|
407
|
+
}}
|
|
408
|
+
/>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### Install Peer Dependencies
|
|
412
|
+
```bash
|
|
413
|
+
npm install react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
|
|
414
|
+
# or
|
|
415
|
+
yarn add react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### Update Image Lightbox
|
|
419
|
+
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.
|
|
420
|
+
|
|
421
|
+
### 📝 Notes
|
|
422
|
+
|
|
423
|
+
- This version includes 170+ commits since v2.8.1
|
|
424
|
+
- Full TypeScript support with improved type definitions
|
|
425
|
+
- Better React Native compatibility (tested with RN 0.81.5)
|
|
426
|
+
- Improved React 19 support
|
|
427
|
+
- Better Expo integration
|
|
428
|
+
|
|
429
|
+
### 👥 Contributors
|
|
430
|
+
|
|
431
|
+
Special thanks to all contributors who made this release possible, including fixes and improvements from the community.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
For detailed commit history, see: https://github.com/FaridSafi/react-native-gifted-chat/compare/2.8.1...3.0.0
|
package/README.md
CHANGED
|
@@ -51,6 +51,34 @@
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
+
<h3 align="center">Sponsors</h3>
|
|
55
|
+
|
|
56
|
+
<table align="center" border="0" cellspacing="20">
|
|
57
|
+
<tr>
|
|
58
|
+
<td align="center" valign="middle">
|
|
59
|
+
<a href="https://www.lereacteur.io" target="_blank"><img src="https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/media/logo_sponsor.png" height="50"></a>
|
|
60
|
+
</td>
|
|
61
|
+
<td align="center" valign="middle">
|
|
62
|
+
<a href="https://getstream.io/chat/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_Chat&utm_term=react-native-gifted-chat" target="_blank"><img src="https://raw.githubusercontent.com/FaridSafi/react-native-gifted-chat/master/media/stream-logo.png" height="35"></a>
|
|
63
|
+
</td>
|
|
64
|
+
<td align="center" valign="middle">
|
|
65
|
+
<a href="https://www.ethora.com" target="_blank"><img src="https://www.dappros.com/wp-content/uploads/2023/12/Ethora-Logo.png" height="50"></a>
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
</table>
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<a href="https://www.lereacteur.io" target="_blank"><strong>Le Reacteur</strong></a> - Coding Bootcamp in Paris co-founded by Farid Safi
|
|
72
|
+
<br>
|
|
73
|
+
<a href="https://getstream.io/chat/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_Chat&utm_term=react-native-gifted-chat" target="_blank"><strong>Stream</strong></a> - Scalable chat API/Server written in Go (<a href="https://getstream.io/chat/get_started/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_Chat&utm_term=react-native-gifted-chat" target="_blank">API Tour</a> | <a href="https://dev.to/nickparsons/react-native-chat-with-chuck-norris-3h7m?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_Chat&utm_term=react-native-gifted-chat" target="_blank">Tutorial</a>)
|
|
74
|
+
<br>
|
|
75
|
+
<a href="https://www.ethora.com" target="_blank"><strong>Ethora</strong></a> - A complete app engine featuring GiftedChat (<a href="https://bit.ly/ethorachat" target="_blank">GitHub</a>)
|
|
76
|
+
<br><br>
|
|
77
|
+
📚 <a href="https://amzn.to/3ZmTyb2" target="_blank">React Key Concepts (2nd ed.)</a>
|
|
78
|
+
</p>
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
54
82
|
## 📖 Table of Contents
|
|
55
83
|
|
|
56
84
|
- [Features](#-features)
|
|
@@ -821,11 +849,11 @@ yarn prepublishOnly
|
|
|
821
849
|
|
|
822
850
|
**Original Author:** [Farid Safi](https://www.x.com/FaridSafi)
|
|
823
851
|
|
|
824
|
-
**Co-
|
|
852
|
+
**Co-author:** [Xavier Carpentier](https://www.x.com/xcapetir) - [Hire Xavier](https://xaviercarpentier.com)
|
|
825
853
|
|
|
826
854
|
**Maintainer:** [Kesha Antonov](https://github.com/kesha-antonov)
|
|
827
855
|
|
|
828
|
-
>
|
|
856
|
+
> I've been maintaining this project for 2 years, completely in my free time and without any compensation. If you find it helpful, please consider [becoming a sponsor](https://github.com/sponsors/kesha-antonov) to support continued development. 💖
|
|
829
857
|
|
|
830
858
|
---
|
|
831
859
|
|
package/lib/Actions.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
export interface ActionsProps {
|
|
4
|
+
actions?: Array<{
|
|
5
|
+
title: string;
|
|
6
|
+
action: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
actionSheetOptionTintColor?: string;
|
|
9
|
+
icon?: () => ReactNode;
|
|
10
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
11
|
+
iconTextStyle?: StyleProp<TextStyle>;
|
|
12
|
+
buttonStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
onPressActionButton?(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function Actions({ actions, actionSheetOptionTintColor, icon, wrapperStyle, iconTextStyle, onPressActionButton, buttonStyle, }: ActionsProps): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../src/Actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAe,MAAM,OAAO,CAAA;AACrD,OAAO,EAGL,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAA;AAQrB,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAA;IACtD,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC,IAAI,CAAC,EAAE,MAAM,SAAS,CAAA;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IACnC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAClC,mBAAmB,CAAC,IAAI,IAAI,CAAA;CAC7B;AAED,wBAAgB,OAAO,CAAE,EACvB,OAAO,EACP,0BAAkD,EAClD,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,WAAW,GACZ,EAAE,YAAY,qBAmDd"}
|
package/lib/Actions.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { StyleSheet, View, } from 'react-native';
|
|
3
|
+
import { Text } from 'react-native-gesture-handler';
|
|
4
|
+
import { Color } from './Color';
|
|
5
|
+
import { TouchableOpacity } from './components/TouchableOpacity';
|
|
6
|
+
import { useChatContext } from './GiftedChatContext';
|
|
7
|
+
import stylesCommon from './styles';
|
|
8
|
+
export function Actions({ actions, actionSheetOptionTintColor = Color.optionTintColor, icon, wrapperStyle, iconTextStyle, onPressActionButton, buttonStyle, }) {
|
|
9
|
+
const { actionSheet } = useChatContext();
|
|
10
|
+
const handlePress = useCallback(() => {
|
|
11
|
+
if (onPressActionButton) {
|
|
12
|
+
onPressActionButton();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!actions?.length)
|
|
16
|
+
return;
|
|
17
|
+
const titles = actions.map(item => item.title);
|
|
18
|
+
actionSheet().showActionSheetWithOptions({
|
|
19
|
+
options: titles,
|
|
20
|
+
cancelButtonIndex: titles.length - 1,
|
|
21
|
+
tintColor: actionSheetOptionTintColor,
|
|
22
|
+
}, (buttonIndex) => {
|
|
23
|
+
if (buttonIndex === undefined)
|
|
24
|
+
return;
|
|
25
|
+
const item = actions[buttonIndex];
|
|
26
|
+
item.action?.();
|
|
27
|
+
});
|
|
28
|
+
}, [actionSheet, actions, actionSheetOptionTintColor, onPressActionButton]);
|
|
29
|
+
const renderIcon = useCallback(() => {
|
|
30
|
+
if (icon)
|
|
31
|
+
return icon();
|
|
32
|
+
return (<View style={[stylesCommon.centerItems, styles.wrapper, wrapperStyle]}>
|
|
33
|
+
<Text style={[styles.iconText, iconTextStyle]}>{'+'}</Text>
|
|
34
|
+
</View>);
|
|
35
|
+
}, [icon, iconTextStyle, wrapperStyle]);
|
|
36
|
+
return (<View style={styles.container}>
|
|
37
|
+
<TouchableOpacity onPress={handlePress} style={[styles.button, buttonStyle]}>
|
|
38
|
+
{renderIcon()}
|
|
39
|
+
</TouchableOpacity>
|
|
40
|
+
</View>);
|
|
41
|
+
}
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
container: {
|
|
44
|
+
alignItems: 'flex-end',
|
|
45
|
+
},
|
|
46
|
+
button: {
|
|
47
|
+
paddingLeft: 10,
|
|
48
|
+
paddingRight: 4,
|
|
49
|
+
paddingVertical: 7,
|
|
50
|
+
},
|
|
51
|
+
wrapper: {
|
|
52
|
+
borderColor: Color.defaultColor,
|
|
53
|
+
borderWidth: 2,
|
|
54
|
+
width: 26,
|
|
55
|
+
height: 26,
|
|
56
|
+
borderRadius: 13,
|
|
57
|
+
},
|
|
58
|
+
iconText: {
|
|
59
|
+
color: Color.defaultColor,
|
|
60
|
+
fontWeight: 'bold',
|
|
61
|
+
fontSize: 16,
|
|
62
|
+
lineHeight: 16,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=Actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Actions.js","sourceRoot":"","sources":["../src/Actions.tsx"],"names":[],"mappings":"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"}
|
package/lib/Avatar.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import { IMessage, LeftRightStyle, User } from './Models';
|
|
4
|
+
export interface AvatarProps<TMessage extends IMessage> {
|
|
5
|
+
currentMessage: TMessage;
|
|
6
|
+
previousMessage?: TMessage;
|
|
7
|
+
nextMessage?: TMessage;
|
|
8
|
+
position: 'left' | 'right';
|
|
9
|
+
isAvatarOnTop?: boolean;
|
|
10
|
+
isAvatarVisibleForEveryMessage?: boolean;
|
|
11
|
+
imageStyle?: LeftRightStyle<ImageStyle>;
|
|
12
|
+
containerStyle?: LeftRightStyle<ViewStyle>;
|
|
13
|
+
textStyle?: TextStyle;
|
|
14
|
+
renderAvatar?(props: Omit<AvatarProps<TMessage>, 'renderAvatar'>): ReactNode;
|
|
15
|
+
onPressAvatar?: (user: User) => void;
|
|
16
|
+
onLongPressAvatar?: (user: User) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function Avatar<TMessage extends IMessage = IMessage>(props: AvatarProps<TMessage>): React.JSX.Element | null;
|
|
19
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAe,MAAM,OAAO,CAAA;AACrD,OAAO,EACL,UAAU,EAEV,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AA6CzD,MAAM,WAAW,WAAW,CAAC,QAAQ,SAAS,QAAQ;IACpD,cAAc,EAAE,QAAQ,CAAA;IACxB,eAAe,CAAC,EAAE,QAAQ,CAAA;IAC1B,WAAW,CAAC,EAAE,QAAQ,CAAA;IACtB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACvC,cAAc,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,YAAY,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,GAAG,SAAS,CAAA;IAC5E,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;CACzC;AAED,wBAAgB,MAAM,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EACzD,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,4BAkG7B"}
|