react-native-gifted-chat 3.0.0-alpha.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/README.md +12 -30
  3. package/package.json +1 -1
  4. package/src/Actions.tsx +27 -18
  5. package/src/Composer.tsx +60 -80
  6. package/src/Constant.ts +0 -9
  7. package/src/GiftedChat/index.tsx +13 -38
  8. package/src/GiftedChat/types.ts +8 -6
  9. package/src/InputToolbar.tsx +6 -11
  10. package/src/MessageImage.tsx +94 -57
  11. package/src/{MessageContainer → MessagesContainer}/components/Item/index.tsx +21 -17
  12. package/src/{MessageContainer → MessagesContainer}/components/Item/types.ts +3 -2
  13. package/src/{MessageContainer → MessagesContainer}/index.tsx +16 -14
  14. package/src/{MessageContainer → MessagesContainer}/types.ts +4 -2
  15. package/src/Send.tsx +40 -22
  16. package/src/__tests__/DayAnimated.test.tsx +1 -1
  17. package/src/__tests__/{MessageContainer.test.tsx → MessagesContainer.test.tsx} +7 -7
  18. package/src/__tests__/__snapshots__/Actions.test.tsx.snap +31 -23
  19. package/src/__tests__/__snapshots__/Composer.test.tsx.snap +39 -30
  20. package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -2
  21. package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +112 -31
  22. package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +251 -0
  23. package/src/__tests__/__snapshots__/Send.test.tsx.snap +189 -49
  24. package/src/index.ts +1 -1
  25. package/src/styles.ts +5 -0
  26. package/src/types.ts +1 -1
  27. package/CHANGELOG_2.8.1_to_2.8.2-alpha.5.md +0 -374
  28. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/index.tsx +0 -0
  29. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/styles.ts +0 -0
  30. /package/src/{MessageContainer → MessagesContainer}/components/DayAnimated/types.ts +0 -0
  31. /package/src/{MessageContainer → MessagesContainer}/styles.ts +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,295 @@
1
+ # Changelog
2
+
3
+ ## [3.0.0] - 2025-11-23
4
+
5
+ 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.
6
+
7
+ ### 🚨 Breaking Changes
8
+
9
+ #### Renamed Props (GiftedChat)
10
+ - `onInputTextChanged` → moved to `textInputProps.onChangeText` (follows React Native naming pattern)
11
+ - `alwaysShowSend` → `isSendButtonAlwaysVisible` (consistent boolean naming convention)
12
+ - `onPress` → `onPressMessage` (more specific naming)
13
+ - `onLongPress` → `onLongPressMessage` (more specific naming)
14
+ - `options` → `actions` (better semantic naming, different type signature)
15
+ - `optionTintColor` → `actionSheetOptionTintColor` (clearer naming)
16
+ - `renderUsernameOnMessage` → `isUsernameVisible` (consistent boolean naming)
17
+ - `showUserAvatar` → `isUserAvatarVisible` (consistent boolean naming)
18
+ - `showAvatarForEveryMessage` → `isAvatarVisibleForEveryMessage` (consistent boolean naming)
19
+ - `renderAvatarOnTop` → `isAvatarOnTop` (consistent boolean naming)
20
+ - `focusOnInputWhenOpeningKeyboard` → `shouldFocusInputOnKeyboardOpen` (consistent boolean naming)
21
+ - `messageContainerRef` → `messagesContainerRef` (typo fix)
22
+ - `alignTop` → `isAlignedTop` (consistent boolean naming)
23
+ - `inverted` → `isInverted` (consistent boolean naming)
24
+
25
+ #### Removed Props (GiftedChat)
26
+ - `bottomOffset` - use `keyboardAvoidingViewProps.keyboardVerticalOffset` instead
27
+ - `disableKeyboardController` - removed keyboard controller configuration
28
+ - `isKeyboardInternallyHandled` - keyboard handling now always uses react-native-keyboard-controller
29
+ - `lightboxProps` - custom Modal implementation replaced react-native-lightbox-v2
30
+ - `placeholder` - moved to `textInputProps.placeholder`
31
+ - `disableComposer` - moved to `textInputProps.editable={false}`
32
+ - `keyboardShouldPersistTaps` - moved to `listProps.keyboardShouldPersistTaps`
33
+ - `maxInputLength` - moved to `textInputProps.maxLength`
34
+ - `extraData` - moved to `listProps.extraData`
35
+ - `infiniteScroll` - use `loadEarlierMessagesProps.isInfiniteScrollEnabled` instead
36
+ - `parsePatterns` - removed, automatic link parsing improved
37
+
38
+ #### Props Moved to MessagesContainer (via spreading)
39
+ These props moved from `GiftedChatProps` to `MessagesContainerProps` but are still accessible on `GiftedChat` via prop spreading:
40
+ - `messages` - now in MessagesContainerProps
41
+ - `isTyping` - now in MessagesContainerProps (via TypingIndicatorProps)
42
+ - `loadEarlier` → `loadEarlierMessagesProps.isAvailable`
43
+ - `isLoadingEarlier` → `loadEarlierMessagesProps.isLoading`
44
+ - `onLoadEarlier` → `loadEarlierMessagesProps.onPress`
45
+ - `renderLoadEarlier` - now in MessagesContainerProps
46
+ - `renderDay` - now in MessagesContainerProps
47
+ - `renderMessage` - now in MessagesContainerProps
48
+ - `renderFooter` - now in MessagesContainerProps
49
+ - `renderChatEmpty` - now in MessagesContainerProps
50
+ - `scrollToBottomStyle` - now in MessagesContainerProps
51
+ - `isScrollToBottomEnabled` - now in MessagesContainerProps
52
+ - `scrollToBottomComponent` - now in MessagesContainerProps
53
+ - `onQuickReply` - now in MessagesContainerProps
54
+ - `listViewProps` → `listProps` (renamed in MessagesContainerProps)
55
+
56
+ #### Type Signature Changes
57
+ - `options`: changed from `{ [key: string]: () => void }` to `Array<{ title: string, action: () => void }>`
58
+ - `textInputProps`: changed from `object` to `Partial<React.ComponentProps<typeof TextInput>>`
59
+ - `renderInputToolbar`: now accepts `React.ComponentType | React.ReactElement | function | null` (can be component, element, function, or null)
60
+ - All callback props now use arrow function syntax instead of function syntax for better type inference
61
+
62
+ #### Dependency Changes
63
+ - Removed `react-native-lightbox-v2` (replaced with custom Modal implementation)
64
+ - Removed `react-native-iphone-x-helper` (deprecated)
65
+ - Removed `react-native-keyboard-controller` as direct dependency
66
+ - Added `react-native-keyboard-controller` as peer dependency (>=1.0.0)
67
+ - Added `react-native-gesture-handler` as peer dependency (>=2.0.0)
68
+ - Added `react-native-reanimated` support for v3 & v4
69
+ - Added `react-native-safe-area-context` as peer dependency (>=5.0.0)
70
+
71
+ ### ✨ New Features
72
+
73
+ #### TypeScript Migration
74
+ - Complete conversion from JavaScript to TypeScript/TSX
75
+ - Improved type safety and IntelliSense support
76
+ - Better type definitions for all components and props
77
+ - Refactored types to arrow functions for better readability
78
+
79
+ #### Keyboard Handling
80
+ - New `keyboardTopToolbarHeight` prop for better keyboard customization
81
+ - New `keyboardAvoidingViewProps` to pass props to KeyboardAvoidingView from react-native-keyboard-controller
82
+ - Improved keyboard behavior and offset handling
83
+ - Consolidated keyboard configuration (removed individual keyboard props in favor of `keyboardAvoidingViewProps`)
84
+ - Fixed auto-grow text input behavior
85
+ - Better keyboard open/close transitions
86
+ - New `OverKeyboardView` component for MessageImage to keep keyboard open
87
+
88
+ #### Message Rendering
89
+ - `isDayAnimationEnabled` prop to control day separator animations
90
+ - Support for passing custom components in render functions
91
+ - Improved message parsing with better link detection
92
+ - Parse links in system messages (fixes #2105)
93
+ - Better phone number parsing with custom matchers support
94
+ - Improved URL parsing (email, phone, URL detection)
95
+
96
+ #### UI & Styling
97
+ - Dark theme support in example app
98
+ - Safe area provider included in library
99
+ - Improved LoadEarlier messages logic
100
+ - Better themed styles implementation
101
+ - Fixed press animation for TouchableOpacity
102
+ - Replaced deprecated `TouchableWithoutFeedback` with `Pressable`
103
+ - Better scroll to bottom button behavior on Android
104
+
105
+ #### Image Viewing
106
+ - Custom Modal implementation replacing react-native-lightbox-v2
107
+ - Better image viewing experience with proper insets handling
108
+ - Improved MessageImage component
109
+
110
+ #### Accessibility & UX
111
+ - `renderTicks` prop for message status indicators
112
+ - Better scroll to bottom wrapper visibility handling
113
+ - `useCallbackThrottled` for improved scroll performance
114
+ - Allow passing children to SystemMessage
115
+ - Improved load earlier messages functionality
116
+
117
+ ### 🐛 Bug Fixes
118
+
119
+ - Fixed duplicate paragraph tags in README
120
+ - Fixed scroll to bottom when `isScrollToBottomEnabled=false` (#2652)
121
+ - Fixed TypeScript type inconsistencies and ESLint errors (#2653)
122
+ - Fixed automatic scroll to bottom issues (#2630, #2621, #2644)
123
+ - Fixed DayAnimated test import and added proper test coverage for renderDay prop
124
+ - Fixed not passed `isDayAnimationEnabled` prop
125
+ - Fixed MessageContainer scroll to bottom press on Android
126
+ - Fixed safer change ScrollToBottomWrapper visibility
127
+ - Fixed dependency cycles in imports
128
+ - Fixed MessageText container style
129
+ - Fixed reanimated issue in MessageContainer
130
+ - Fixed construct messages on send in example
131
+ - Fixed web support in example
132
+ - Fixed #2659 (memoization issues)
133
+ - Fixed #2640 (various bug fixes)
134
+ - Fixed show location in example
135
+ - Fixed errors in keyboard handling
136
+ - Fixed load earlier messages functionality
137
+ - Fixed Bubble type parameter to re-enable generics on message prop (#2639)
138
+ - Fixed listViewProps typing with Partial<FlatListProps> (#2628)
139
+ - Fixed MessageContainer to add renderDay prop and insert DayAnimated Component (#2632)
140
+ - Fixed dateFormatCalendar default value in README
141
+
142
+ ### 🔧 Improvements
143
+
144
+ #### Performance
145
+ - Memoized values & functions for better performance
146
+ - Better scroll performance with throttled callbacks
147
+ - Optimized re-renders
148
+
149
+ #### Code Quality
150
+ - Added ESLint with import sorting
151
+ - Fixed all examples with ESLint
152
+ - Improved code structure and organization
153
+ - Better error handling
154
+ - Cleaner prop passing and component structure
155
+
156
+ #### Testing
157
+ - All tests converted to TypeScript
158
+ - Updated snapshots for new components
159
+ - Run tests in correct timezone (Europe/Paris)
160
+ - Improved test coverage
161
+ - Added comprehensive copilot instructions with validated commands
162
+
163
+ #### Documentation
164
+ - Improved README structure and formatting
165
+ - Better prop documentation and grouping
166
+ - Added matchers example
167
+ - Added working Expo Snack link
168
+ - Better feature documentation
169
+ - Added maintainer section
170
+ - Improved previews and images
171
+ - Added export documentation
172
+ - Fixed formatting issues and typos
173
+ - Better keyboard props documentation
174
+
175
+ #### Example App
176
+ - Updated to latest React Native and Expo
177
+ - Added tabs with different chat examples
178
+ - Added working link to Expo Snack
179
+ - Better example organization
180
+ - Added dark theme support
181
+ - Removed padding from bottom of toolbar
182
+ - Added custom phone matcher example
183
+ - Switch to dev build in README
184
+ - Android: transparent navigation & status bars by default
185
+ - Better project structure with multiple example types
186
+
187
+ #### Build & Development
188
+ - Better dependency management
189
+ - Updated to Node.js >= 20
190
+ - Yarn 1.22.22+ as package manager
191
+ - Added stale workflow for issue management
192
+ - Script to rebuild native dependencies
193
+ - Improved local development setup
194
+
195
+ ### 📦 Dependencies
196
+
197
+ #### Added
198
+ - `@expo/react-native-action-sheet`: ^4.1.1
199
+ - `@types/lodash.isequal`: ^4.5.8
200
+ - `dayjs`: ^1.11.19
201
+ - `lodash.isequal`: ^4.5.0
202
+ - `react-native-autolink`: ^4.2.0
203
+ - `react-native-zoom-reanimated`: ^1.4.10
204
+
205
+ #### Peer Dependencies (now required)
206
+ - `react`: >=18.0.0
207
+ - `react-native`: *
208
+ - `react-native-gesture-handler`: >=2.0.0
209
+ - `react-native-keyboard-controller`: >=1.0.0
210
+ - `react-native-reanimated`: >=3.0.0 || ^4.0.0
211
+ - `react-native-safe-area-context`: >=5.0.0
212
+
213
+ ### 🔄 Migration Guide
214
+
215
+ #### Update Prop Names
216
+ ```javascript
217
+ // Before (v2.8.1)
218
+ <GiftedChat
219
+ messages={messages}
220
+ onInputTextChanged={handleTextChange}
221
+ alwaysShowSend={true}
222
+ onPress={handlePress}
223
+ onLongPress={handleLongPress}
224
+ options={{ 'Option 1': action1, 'Option 2': action2 }}
225
+ optionTintColor="#007AFF"
226
+ bottomOffset={100}
227
+ placeholder="Type a message..."
228
+ maxInputLength={1000}
229
+ renderUsernameOnMessage={true}
230
+ showUserAvatar={false}
231
+ showAvatarForEveryMessage={false}
232
+ renderAvatarOnTop={false}
233
+ alignTop={false}
234
+ inverted={true}
235
+ loadEarlier={true}
236
+ isLoadingEarlier={false}
237
+ onLoadEarlier={handleLoadEarlier}
238
+ />
239
+
240
+ // After (v3.0.0)
241
+ <GiftedChat
242
+ messages={messages}
243
+ textInputProps={{
244
+ onChangeText: handleTextChange,
245
+ placeholder: "Type a message...",
246
+ maxLength: 1000
247
+ }}
248
+ isSendButtonAlwaysVisible={true}
249
+ onPressMessage={handlePress}
250
+ onLongPressMessage={handleLongPress}
251
+ actions={[
252
+ { title: 'Option 1', action: action1 },
253
+ { title: 'Option 2', action: action2 }
254
+ ]}
255
+ actionSheetOptionTintColor="#007AFF"
256
+ keyboardAvoidingViewProps={{ keyboardVerticalOffset: 100 }}
257
+ isUsernameVisible={true}
258
+ isUserAvatarVisible={false}
259
+ isAvatarVisibleForEveryMessage={false}
260
+ isAvatarOnTop={false}
261
+ isAlignedTop={false}
262
+ isInverted={true}
263
+ loadEarlierMessagesProps={{
264
+ isAvailable: true,
265
+ isLoading: false,
266
+ onPress: handleLoadEarlier
267
+ }}
268
+ />
269
+ ```
270
+
271
+ #### Install Peer Dependencies
272
+ ```bash
273
+ npm install react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
274
+ # or
275
+ yarn add react-native-gesture-handler react-native-keyboard-controller react-native-reanimated react-native-safe-area-context
276
+ ```
277
+
278
+ #### Update Image Lightbox
279
+ 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.
280
+
281
+ ### 📝 Notes
282
+
283
+ - This version includes 170+ commits since v2.8.1
284
+ - Full TypeScript support with improved type definitions
285
+ - Better React Native compatibility (tested with RN 0.81.5)
286
+ - Improved React 19 support
287
+ - Better Expo integration
288
+
289
+ ### 👥 Contributors
290
+
291
+ Special thanks to all contributors who made this release possible, including fixes and improvements from the community.
292
+
293
+ ---
294
+
295
+ For detailed commit history, see: https://github.com/FaridSafi/react-native-gifted-chat/compare/2.8.1...3.0.0
package/README.md CHANGED
@@ -53,6 +53,8 @@
53
53
  - System message
54
54
  - Quick Reply messages (bot)
55
55
  - Typing indicator
56
+ - Ticks indicator to display message status ( delivered, read )
57
+ - Scroll to bottom button
56
58
  - react-native-web [web configuration](#react-native-web)
57
59
 
58
60
  ## Sponsor
@@ -143,6 +145,7 @@ Follow guide: [react-native-reanimated](https://docs.swmansion.com/react-native-
143
145
 
144
146
  ```jsx
145
147
  import React, { useState, useCallback, useEffect } from 'react'
148
+ import { Platform } from 'react-native'
146
149
  import { GiftedChat } from 'react-native-gifted-chat'
147
150
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
148
151
 
@@ -152,7 +155,8 @@ export function Example() {
152
155
 
153
156
  // If you have a tab bar, include its height
154
157
  const tabbarHeight = 50
155
- const keyboardVerticalOffset = insets.bottom + tabbarHeight
158
+ const keyboardTopToolbarHeight = Platform.select({ ios: 44, default: 0 })
159
+ const keyboardVerticalOffset = insets.bottom + tabbarHeight + keyboardTopToolbarHeight
156
160
 
157
161
  useEffect(() => {
158
162
  setMessages([
@@ -209,7 +213,7 @@ Messages, system messages, quick replies etc.: [data structure](src/Models.ts)
209
213
 
210
214
  ### Refs
211
215
 
212
- - **`messageContainerRef`** _(FlatList ref)_ - Ref to the flatlist
216
+ - **`messagesContainerRef`** _(FlatList ref)_ - Ref to the flatlist
213
217
  - **`textInputRef`** _(TextInput ref)_ - Ref to the text input
214
218
 
215
219
  ### Keyboard & Layout
@@ -232,7 +236,7 @@ Messages, system messages, quick replies etc.: [data structure](src/Models.ts)
232
236
  - **`renderSend`** _(Component | Function)_ - Custom send button; you can pass children to the original `Send` component quite easily, for example, to use a custom icon ([example](https://github.com/FaridSafi/react-native-gifted-chat/pull/487))
233
237
  - **`renderActions`** _(Component | Function)_ - Custom action button on the left of the message composer
234
238
  - **`renderAccessory`** _(Component | Function)_ - Custom second line of actions below the message composer
235
- - **`textInputProps`** _(Object)_ - props to be passed to the [`<TextInput>`](https://reactnative.dev/docs/textinput.html).
239
+ - **`textInputProps`** _(Object)_ - props to be passed to the [`<TextInput>`](https://reactnative.dev/docs/textinput).
236
240
 
237
241
  ### Actions & Action Sheet
238
242
 
@@ -247,22 +251,21 @@ Messages, system messages, quick replies etc.: [data structure](src/Models.ts)
247
251
  - **`renderMessage`** _(Component | Function)_ - Custom message container
248
252
  - **`renderLoading`** _(Component | Function)_ - Render a loading view when initializing
249
253
  - **`renderChatEmpty`** _(Component | Function)_ - Custom component to render in the ListView when messages are empty
250
- - **`renderChatFooter`** _(Component | Function)_ - Custom component to render below the MessageContainer (separate from the ListView)
251
- - **`listProps`** _(Object)_ - Extra props to be passed to the messages [`<FlatList>`](https://reactnative.dev/docs/flatlist.html); some props can't be overridden, see the code in `MessageContainer.render()` for details
254
+ - **`renderChatFooter`** _(Component | Function)_ - Custom component to render below the MessagesContainer (separate from the ListView)
255
+ - **`listProps`** _(Object)_ - Extra props to be passed to the messages [`<FlatList>`](https://reactnative.dev/docs/flatlist)
252
256
 
253
257
  ### Message Bubbles & Content
254
258
 
255
- - **`renderBubble`** _(Component | Function)_ - Custom message bubble
259
+ - **`renderBubble`** _(Component | Function(`props: BubbleProps`))_ - Custom message bubble. Receives [BubbleProps](src/Bubble/types.ts) as parameter.
256
260
  - **`renderMessageText`** _(Component | Function)_ - Custom message text
257
261
  - **`renderMessageImage`** _(Component | Function)_ - Custom message image
258
262
  - **`renderMessageVideo`** _(Component | Function)_ - Custom message video
259
263
  - **`renderMessageAudio`** _(Component | Function)_ - Custom message audio
260
264
  - **`renderCustomView`** _(Component | Function)_ - Custom view inside the bubble
261
265
  - **`isCustomViewBottom`** _(Bool)_ - Determine whether renderCustomView is displayed before or after the text, image and video views; default is `false`
262
- - **`renderTicks`** _(Component | Function(`message`))_ - Custom ticks indicator to display message status
263
266
  - **`onPressMessage`** _(Function(`context`, `message`))_ - Callback when a message bubble is pressed
264
267
  - **`onLongPressMessage`** _(Function(`context`, `message`))_ - Callback when a message bubble is long-pressed; you can use this to show action sheets (e.g., copy, delete, reply)
265
- - **`imageProps`** _(Object)_ - Extra props to be passed to the [`<Image>`](https://reactnative.dev/docs/image.html) component created by the default `renderMessageImage`
268
+ - **`imageProps`** _(Object)_ - Extra props to be passed to the [`<Image>`](https://reactnative.dev/docs/image) component created by the default `renderMessageImage`
266
269
  - **`imageStyle`** _(Object)_ - Custom style for message images
267
270
  - **`videoProps`** _(Object)_ - Extra props to be passed to the video component created by the required `renderMessageVideo`
268
271
  - **`messageTextProps`** _(Object)_ - Extra props to be passed to the MessageText component. Useful for customizing link parsing behavior, text styles, and matchers. Supports all [react-native-autolink](https://github.com/joshswan/react-native-autolink) props including:
@@ -344,6 +347,7 @@ See full example in [LinksExample](example/components/chat-examples/LinksExample
344
347
  - **`renderDay`** _(Component | Function)_ - Custom day above a message
345
348
  - **`renderTime`** _(Component | Function)_ - Custom time inside a message
346
349
  - **`timeTextStyle`** _(Object)_ - Custom text style for time inside messages (supports left/right styles)
350
+ - **`isDayAnimationEnabled`** _(Bool)_ - Enable animated day label that appears on scroll; default is `true`
347
351
 
348
352
  ### System Messages
349
353
 
@@ -417,30 +421,8 @@ If you are using Create React Native App / Expo, no Android specific installatio
417
421
  </View>
418
422
  ```
419
423
 
420
- If you use React Navigation, additional handling may be required to account for navigation headers and tabs. `KeyboardAvoidingView`'s `keyboardVerticalOffset` property can be set to the height of the navigation header and [`tabBarOptions.keyboardHidesTabBar`](https://reactnavigation.org/docs/en/bottom-tab-navigator.html#bottomtabnavigatorconfig) can be set to keep the tab bar from being shown when the keyboard is up. Due to a [bug with calculating height on Android phones with notches](facebook/react-native#23693), `KeyboardAvoidingView` is recommended over other solutions that involve calculating the height of the window.
421
-
422
- - adding an opaque background status bar on app.json (even though `android:windowSoftInputMode="adjustResize"` is set internally on Expo's Android apps, the translucent status bar causes it not to work): https://docs.expo.io/versions/latest/guides/configuration.html#androidstatusbar
423
-
424
- - If you plan to use `GiftedChat` inside a `Modal`, see [#200](https://github.com/FaridSafi/react-native-gifted-chat/issues/200).
425
-
426
424
  ## Notes for local development
427
425
 
428
- ### Native
429
-
430
- 1. Install `yarn global add expo-cli`
431
- 2. Install dependencies`yarn install`
432
- 3. `expo start`
433
-
434
- ### react-native-web
435
-
436
- #### With expo
437
-
438
- 1. Install `yarn global add expo-cli`
439
- 2. Install dependencies`yarn install`
440
- 3. `expo start -w`
441
-
442
- [Upgrade snack version](https://snackager.expo.io/bundle/react-native-gifted-chat@0.15.0?bypassCache=true)
443
-
444
426
  #### With create-react-app
445
427
 
446
428
  1. `yarn add -D react-app-rewired`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-chat",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.1",
4
4
  "description": "The most complete chat UI for React Native",
5
5
  "keywords": [
6
6
  "android",
package/src/Actions.tsx CHANGED
@@ -19,7 +19,7 @@ export interface ActionsProps {
19
19
  icon?: () => ReactNode
20
20
  wrapperStyle?: StyleProp<ViewStyle>
21
21
  iconTextStyle?: StyleProp<TextStyle>
22
- containerStyle?: StyleProp<ViewStyle>
22
+ buttonStyle?: StyleProp<ViewStyle>
23
23
  onPressActionButton?(): void
24
24
  }
25
25
 
@@ -30,11 +30,16 @@ export function Actions ({
30
30
  wrapperStyle,
31
31
  iconTextStyle,
32
32
  onPressActionButton,
33
- containerStyle,
33
+ buttonStyle,
34
34
  }: ActionsProps) {
35
35
  const { actionSheet } = useChatContext()
36
36
 
37
- const onActionsPress = useCallback(() => {
37
+ const handlePress = useCallback(() => {
38
+ if (onPressActionButton) {
39
+ onPressActionButton()
40
+ return
41
+ }
42
+
38
43
  if (!actions?.length)
39
44
  return
40
45
 
@@ -54,47 +59,51 @@ export function Actions ({
54
59
  item.action?.()
55
60
  }
56
61
  )
57
- }, [actionSheet, actions, actionSheetOptionTintColor])
62
+ }, [actionSheet, actions, actionSheetOptionTintColor, onPressActionButton])
58
63
 
59
64
  const renderIcon = useCallback(() => {
60
65
  if (icon)
61
66
  return icon()
62
67
 
63
68
  return (
64
- <View style={[stylesCommon.fill, stylesCommon.centerItems, styles.wrapper, wrapperStyle]}>
69
+ <View style={[stylesCommon.centerItems, styles.wrapper, wrapperStyle]}>
65
70
  <Text style={[styles.iconText, iconTextStyle]}>{'+'}</Text>
66
71
  </View>
67
72
  )
68
73
  }, [icon, iconTextStyle, wrapperStyle])
69
74
 
70
75
  return (
71
- <TouchableOpacity
72
- style={[styles.container, containerStyle]}
73
- onPress={onPressActionButton || onActionsPress}
74
- >
75
- {renderIcon()}
76
- </TouchableOpacity>
76
+ <View style={styles.container}>
77
+ <TouchableOpacity
78
+ onPress={handlePress}
79
+ style={[styles.button, buttonStyle]}
80
+ >
81
+ {renderIcon()}
82
+ </TouchableOpacity>
83
+ </View>
77
84
  )
78
85
  }
79
86
 
80
87
  const styles = StyleSheet.create({
81
88
  container: {
82
- width: 26,
83
- height: 26,
84
- marginLeft: 10,
85
- marginBottom: 10,
89
+ alignItems: 'flex-end',
90
+ },
91
+ button: {
92
+ paddingHorizontal: 8,
93
+ paddingVertical: 7,
86
94
  },
95
+
87
96
  wrapper: {
88
- borderRadius: 13,
89
97
  borderColor: Color.defaultColor,
90
98
  borderWidth: 2,
99
+ width: 26,
100
+ height: 26,
101
+ borderRadius: 13,
91
102
  },
92
103
  iconText: {
93
104
  color: Color.defaultColor,
94
105
  fontWeight: 'bold',
95
106
  fontSize: 16,
96
107
  lineHeight: 16,
97
- backgroundColor: Color.backgroundTransparent,
98
- textAlign: 'center',
99
108
  },
100
109
  })