react-native-gifted-chat 2.8.0 → 2.8.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +18 -5
  2. package/lib/Bubble/index.d.ts +3 -27
  3. package/lib/Bubble/index.js +138 -125
  4. package/lib/Bubble/index.js.map +1 -1
  5. package/lib/Bubble/types.d.ts +3 -3
  6. package/lib/GiftedChat/index.js +19 -4
  7. package/lib/GiftedChat/index.js.map +1 -1
  8. package/lib/GiftedChat/types.d.ts +5 -10
  9. package/lib/Message/index.js +7 -12
  10. package/lib/Message/index.js.map +1 -1
  11. package/lib/Message/types.d.ts +2 -2
  12. package/lib/MessageContainer/components/Item/index.js +3 -1
  13. package/lib/MessageContainer/components/Item/index.js.map +1 -1
  14. package/lib/MessageContainer/index.js +69 -46
  15. package/lib/MessageContainer/index.js.map +1 -1
  16. package/lib/MessageContainer/styles.d.ts +3 -2
  17. package/lib/MessageContainer/styles.js +3 -2
  18. package/lib/MessageContainer/styles.js.map +1 -1
  19. package/lib/MessageContainer/types.d.ts +6 -9
  20. package/lib/MessageText.d.ts +11 -7
  21. package/lib/MessageText.js +57 -96
  22. package/lib/MessageText.js.map +1 -1
  23. package/lib/SystemMessage.d.ts +2 -1
  24. package/lib/SystemMessage.js +3 -2
  25. package/lib/SystemMessage.js.map +1 -1
  26. package/lib/utils.d.ts +2 -0
  27. package/lib/utils.js +66 -0
  28. package/lib/utils.js.map +1 -1
  29. package/package.json +37 -30
  30. package/src/Bubble/index.tsx +171 -172
  31. package/src/Bubble/types.ts +3 -3
  32. package/src/GiftedChat/index.tsx +23 -3
  33. package/src/GiftedChat/types.ts +6 -4
  34. package/src/Message/index.tsx +10 -16
  35. package/src/Message/types.ts +2 -2
  36. package/src/MessageContainer/components/Item/index.tsx +1 -0
  37. package/src/MessageContainer/index.tsx +93 -58
  38. package/src/MessageContainer/styles.ts +3 -2
  39. package/src/MessageContainer/types.ts +6 -9
  40. package/src/MessageText.tsx +86 -121
  41. package/src/SystemMessage.tsx +4 -1
  42. package/src/__tests__/DayAnimated.test.tsx +54 -0
  43. package/src/__tests__/GiftedChat.test.tsx +25 -0
  44. package/src/__tests__/__snapshots__/DayAnimated.test.tsx.snap +5 -0
  45. package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +25 -0
  46. package/src/__tests__/__snapshots__/MessageContainer.test.tsx.snap +11 -9
  47. package/src/utils.ts +77 -1
package/README.md CHANGED
@@ -78,6 +78,10 @@
78
78
  <a href="https://bit.ly/ethorachat" target="_blank">Check out our GitHub</a>
79
79
  </p>
80
80
  </p>
81
+ <br>
82
+ <p align="center">
83
+ <a href="https://amzn.to/3ZmTyb2" target="_blank">React Key Concepts: Consolidate your knowledge of React’s core features (2nd ed. Edition)</a>
84
+ </p>
81
85
 
82
86
  ## Features
83
87
 
@@ -99,6 +103,14 @@
99
103
 
100
104
  # Getting started
101
105
 
106
+ ## 🚧👷 Important notice
107
+
108
+ There's currently WIP going on to make the library more performant, modern in terms of chat UI and easier to maintain. If you have any issues, please report them. If you want to contribute, please do so.
109
+
110
+ The most stable version is `2.6.5`. If you want to use the latest version, please be aware that it's a work in progress.
111
+
112
+ Readme for this version: [2.6.5 readme](https://github.com/FaridSafi/react-native-gifted-chat/blob/eebab3751fcbe07715135e6e7b2aa3f76a10d8ac/README.md)
113
+
102
114
  ## Installation
103
115
 
104
116
  ### Install dependencies
@@ -343,6 +355,7 @@ interface QuickReplies {
343
355
  - **`messages`** _(Array)_ - Messages to display
344
356
  - **`isTyping`** _(Bool)_ - Typing Indicator state; default `false`. If you use`renderFooter` it will override this.
345
357
  - **`isKeyboardInternallyHandled`** _(Bool)_ - Determine whether to handle keyboard awareness inside the plugin. If you have your own keyboard handling outside the plugin set this to false; default is `true`
358
+ - **`disableKeyboardController`** _(Bool)_ - Completely disable react-native-keyboard-controller. Useful when using react-native-navigation or other conflicting keyboard libraries; default is `false`
346
359
  - **`text`** _(String)_ - Input text; default is `undefined`, but if specified, it will override GiftedChat's internal state (e.g. for redux; [see notes below](#notes-for-redux))
347
360
  - **`placeholder`** _(String)_ - Placeholder when `text` is empty; default is `'Type a message...'`
348
361
  - **`messageIdGenerator`** _(Function)_ - Generate an id for new messages. Defaults to UUID v4, generated by [uuid](https://github.com/kelektiv/node-uuid)
@@ -352,7 +365,7 @@ interface QuickReplies {
352
365
  - **`locale`** _(String)_ - Locale to localize the dates. You need first to import the locale you need (ie. `require('dayjs/locale/de')` or `import 'dayjs/locale/fr'`)
353
366
  - **`timeFormat`** _(String)_ - Format to use for rendering times; default is `'LT'` (see [Day.js Format](https://day.js.org/docs/en/display/format))
354
367
  - **`dateFormat`** _(String)_ - Format to use for rendering dates; default is `'D MMMM'` (see [Day.js Format](https://day.js.org/docs/en/display/format))
355
- - **`dateFormatCalendar`** _(String)_ - Format to use for rendering relative times; Today - for now (see [Day.js Calendar](https://day.js.org/docs/en/plugin/calendar))
368
+ - **`dateFormatCalendar`** _(Object)_ - Format to use for rendering relative times; default is `{ sameDay: '[Today]' }` (see [Day.js Calendar](https://day.js.org/docs/en/plugin/calendar))
356
369
  - **`loadEarlier`** _(Bool)_ - Enables the "load earlier messages" button, required for `infiniteScroll`
357
370
  - **`onLoadEarlier`** _(Function)_ - Callback when loading earlier messages
358
371
  - **`isLoadingEarlier`** _(Bool)_ - Display an `ActivityIndicator` when loading earlier messages
@@ -402,13 +415,13 @@ interface QuickReplies {
402
415
  - **`keyboardShouldPersistTaps`** _(Enum)_ - Determines whether the keyboard should stay visible after a tap; see [`<ScrollView>`](https://facebook.github.io/react-native/docs/scrollview.html) docs
403
416
  - **`onInputTextChanged`** _(Function)_ - Callback when the input text changes
404
417
  - **`maxInputLength`** _(Integer)_ - Max message composer TextInput length
405
- - **`parsePatterns`** _(Function)_ - Custom parse patterns for [react-native-parsed-text](https://github.com/taskrabbit/react-native-parsed-text) used to linking message content (like URLs and phone numbers), e.g.:
418
+ - **`matchers`** _(Array)_ - Custom matchers for [react-native-autolink](https://github.com/joshswan/react-native-autolink) used to linking message content (like URLs and phone numbers), e.g.:
406
419
 
407
420
  ```js
408
421
  <GiftedChat
409
- parsePatterns={(linkStyle) => [
410
- { type: 'phone', style: linkStyle, onPress: this.onPressPhoneNumber },
411
- { pattern: /#(\w+)/, style: { ...linkStyle, styles.hashtag }, onPress: this.onPressHashtag },
422
+ matchers={[
423
+ { type: 'phone', style: linkStyle, onPress: onPressPhoneNumber },
424
+ { pattern: /#(\w+)/, style: [linkStyle, styles.hashtag], onPress: onPressHashtag },
412
425
  ]}
413
426
  />
414
427
  ```
@@ -1,30 +1,6 @@
1
- import React from 'react';
1
+ import { JSX } from 'react';
2
2
  import { IMessage } from '../types';
3
3
  import { BubbleProps } from './types';
4
4
  export * from './types';
5
- export default class Bubble<TMessage extends IMessage = IMessage> extends React.Component<BubbleProps<TMessage>> {
6
- static contextType: React.Context<import("..").IGiftedChatContext>;
7
- onPress: () => void;
8
- onLongPress: () => void;
9
- styledBubbleToNext(): (import("react-native").StyleProp<import("react-native").ViewStyle> | {
10
- borderBottomLeftRadius: number;
11
- } | {
12
- borderBottomRightRadius: number;
13
- })[] | null;
14
- styledBubbleToPrevious(): (import("react-native").StyleProp<import("react-native").ViewStyle> | {
15
- borderTopLeftRadius: number;
16
- } | {
17
- borderTopRightRadius: number;
18
- })[] | null;
19
- renderQuickReplies(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
20
- renderMessageText(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
21
- renderMessageImage(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
22
- renderMessageVideo(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
23
- renderMessageAudio(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
24
- renderTicks(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
25
- renderTime(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
26
- renderUsername(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
27
- renderCustomView(): React.ReactNode;
28
- renderBubbleContent(): React.JSX.Element;
29
- render(): React.JSX.Element;
30
- }
5
+ declare const Bubble: <TMessage extends IMessage = IMessage>(props: BubbleProps<TMessage>) => JSX.Element;
6
+ export default Bubble;
@@ -1,6 +1,6 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { Text, TouchableWithoutFeedback, View, } from 'react-native';
3
- import { GiftedChatContext } from '../GiftedChatContext';
3
+ import { useChatContext } from '../GiftedChatContext';
4
4
  import { QuickReplies } from '../QuickReplies';
5
5
  import { MessageText } from '../MessageText';
6
6
  import { MessageImage } from '../MessageImage';
@@ -11,33 +11,20 @@ import { isSameUser, isSameDay } from '../utils';
11
11
  import stylesCommon from '../styles';
12
12
  import styles from './styles';
13
13
  export * from './types';
14
- class Bubble extends React.Component {
15
- constructor() {
16
- super(...arguments);
17
- this.onPress = () => {
18
- if (this.props.onPress)
19
- this.props.onPress(this.context, this.props.currentMessage);
20
- };
21
- this.onLongPress = () => {
22
- const { currentMessage, onLongPress, optionTitles, } = this.props;
23
- if (onLongPress) {
24
- onLongPress(this.context, currentMessage);
25
- return;
26
- }
27
- if (!optionTitles?.length)
28
- return;
29
- const options = optionTitles;
30
- const cancelButtonIndex = options.length - 1;
31
- this.context.actionSheet().showActionSheetWithOptions({
32
- options,
33
- cancelButtonIndex,
34
- }, (buttonIndex) => {
35
- console.log('onLongPress', { buttonIndex });
36
- });
37
- };
38
- }
39
- styledBubbleToNext() {
40
- const { currentMessage, nextMessage, position, containerToNextStyle } = this.props;
14
+ const Bubble = (props) => {
15
+ const { currentMessage, nextMessage, position, containerToNextStyle, previousMessage, containerToPreviousStyle, onQuickReply, renderQuickReplySend, quickReplyStyle, quickReplyTextStyle, quickReplyContainerStyle, containerStyle, wrapperStyle, bottomContainerStyle, onPress: onPressProp, onLongPress: onLongPressProp, } = props;
16
+ const context = useChatContext();
17
+ const onPress = useCallback(() => {
18
+ onPressProp?.(context, currentMessage);
19
+ }, [onPressProp, context, currentMessage]);
20
+ const onLongPress = useCallback(() => {
21
+ onLongPressProp?.(context, currentMessage);
22
+ }, [
23
+ currentMessage,
24
+ context,
25
+ onLongPressProp,
26
+ ]);
27
+ const styledBubbleToNext = useCallback(() => {
41
28
  if (currentMessage &&
42
29
  nextMessage &&
43
30
  position &&
@@ -48,9 +35,13 @@ class Bubble extends React.Component {
48
35
  containerToNextStyle?.[position],
49
36
  ];
50
37
  return null;
51
- }
52
- styledBubbleToPrevious() {
53
- const { currentMessage, previousMessage, position, containerToPreviousStyle, } = this.props;
38
+ }, [
39
+ currentMessage,
40
+ nextMessage,
41
+ position,
42
+ containerToNextStyle,
43
+ ]);
44
+ const styledBubbleToPrevious = useCallback(() => {
54
45
  if (currentMessage &&
55
46
  previousMessage &&
56
47
  position &&
@@ -58,76 +49,89 @@ class Bubble extends React.Component {
58
49
  isSameDay(currentMessage, previousMessage))
59
50
  return [
60
51
  styles[position].containerToPrevious,
61
- containerToPreviousStyle && containerToPreviousStyle[position],
52
+ containerToPreviousStyle?.[position],
62
53
  ];
63
54
  return null;
64
- }
65
- renderQuickReplies() {
66
- const { currentMessage, onQuickReply, nextMessage, renderQuickReplySend, quickReplyStyle, quickReplyTextStyle, quickReplyContainerStyle, } = this.props;
55
+ }, [
56
+ currentMessage,
57
+ previousMessage,
58
+ position,
59
+ containerToPreviousStyle,
60
+ ]);
61
+ const renderQuickReplies = useCallback(() => {
67
62
  if (currentMessage?.quickReplies) {
68
63
  const {
69
64
  /* eslint-disable @typescript-eslint/no-unused-vars */
70
65
  containerStyle, wrapperStyle,
71
66
  /* eslint-enable @typescript-eslint/no-unused-vars */
72
- ...quickReplyProps } = this.props;
73
- if (this.props.renderQuickReplies)
74
- return this.props.renderQuickReplies(quickReplyProps);
67
+ ...quickReplyProps } = props;
68
+ if (props.renderQuickReplies)
69
+ return props.renderQuickReplies(quickReplyProps);
75
70
  return (<QuickReplies currentMessage={currentMessage} onQuickReply={onQuickReply} renderQuickReplySend={renderQuickReplySend} quickReplyStyle={quickReplyStyle} quickReplyTextStyle={quickReplyTextStyle} quickReplyContainerStyle={quickReplyContainerStyle} nextMessage={nextMessage}/>);
76
71
  }
77
72
  return null;
78
- }
79
- renderMessageText() {
80
- if (this.props.currentMessage?.text) {
73
+ }, [
74
+ currentMessage,
75
+ onQuickReply,
76
+ renderQuickReplySend,
77
+ quickReplyStyle,
78
+ quickReplyTextStyle,
79
+ quickReplyContainerStyle,
80
+ nextMessage,
81
+ props,
82
+ ]);
83
+ const renderMessageText = useCallback(() => {
84
+ if (currentMessage?.text) {
81
85
  const {
82
86
  /* eslint-disable @typescript-eslint/no-unused-vars */
83
- containerStyle, wrapperStyle, optionTitles,
87
+ containerStyle, wrapperStyle,
84
88
  /* eslint-enable @typescript-eslint/no-unused-vars */
85
- ...messageTextProps } = this.props;
86
- if (this.props.renderMessageText)
87
- return this.props.renderMessageText(messageTextProps);
89
+ ...messageTextProps } = props;
90
+ if (props.renderMessageText)
91
+ return props.renderMessageText(messageTextProps);
88
92
  return <MessageText {...messageTextProps}/>;
89
93
  }
90
94
  return null;
91
- }
92
- renderMessageImage() {
93
- if (this.props.currentMessage?.image) {
95
+ }, [props, currentMessage]);
96
+ const renderMessageImage = useCallback(() => {
97
+ if (currentMessage?.image) {
94
98
  const {
95
99
  /* eslint-disable @typescript-eslint/no-unused-vars */
96
100
  containerStyle, wrapperStyle,
97
101
  /* eslint-enable @typescript-eslint/no-unused-vars */
98
- ...messageImageProps } = this.props;
99
- if (this.props.renderMessageImage)
100
- return this.props.renderMessageImage(messageImageProps);
102
+ ...messageImageProps } = props;
103
+ if (props.renderMessageImage)
104
+ return props.renderMessageImage(messageImageProps);
101
105
  return <MessageImage {...messageImageProps}/>;
102
106
  }
103
107
  return null;
104
- }
105
- renderMessageVideo() {
106
- if (!this.props.currentMessage?.video)
108
+ }, [props, currentMessage]);
109
+ const renderMessageVideo = useCallback(() => {
110
+ if (!currentMessage?.video)
107
111
  return null;
108
112
  const {
109
113
  /* eslint-disable @typescript-eslint/no-unused-vars */
110
114
  containerStyle, wrapperStyle,
111
115
  /* eslint-enable @typescript-eslint/no-unused-vars */
112
- ...messageVideoProps } = this.props;
113
- if (this.props.renderMessageVideo)
114
- return this.props.renderMessageVideo(messageVideoProps);
116
+ ...messageVideoProps } = props;
117
+ if (props.renderMessageVideo)
118
+ return props.renderMessageVideo(messageVideoProps);
115
119
  return <MessageVideo />;
116
- }
117
- renderMessageAudio() {
118
- if (!this.props.currentMessage?.audio)
120
+ }, [props, currentMessage]);
121
+ const renderMessageAudio = useCallback(() => {
122
+ if (!currentMessage?.audio)
119
123
  return null;
120
124
  const {
121
125
  /* eslint-disable @typescript-eslint/no-unused-vars */
122
126
  containerStyle, wrapperStyle,
123
127
  /* eslint-enable @typescript-eslint/no-unused-vars */
124
- ...messageAudioProps } = this.props;
125
- if (this.props.renderMessageAudio)
126
- return this.props.renderMessageAudio(messageAudioProps);
128
+ ...messageAudioProps } = props;
129
+ if (props.renderMessageAudio)
130
+ return props.renderMessageAudio(messageAudioProps);
127
131
  return <MessageAudio />;
128
- }
129
- renderTicks() {
130
- const { currentMessage, renderTicks, user, } = this.props;
132
+ }, [props, currentMessage]);
133
+ const renderTicks = useCallback(() => {
134
+ const { renderTicks, user, } = props;
131
135
  if (renderTicks && currentMessage)
132
136
  return renderTicks(currentMessage);
133
137
  if (user &&
@@ -137,93 +141,102 @@ class Bubble extends React.Component {
137
141
  if (currentMessage &&
138
142
  (currentMessage.sent || currentMessage.received || currentMessage.pending))
139
143
  return (<View style={styles.content.tickView}>
140
- {!!currentMessage.sent && (<Text style={[styles.content.tick, this.props.tickStyle]}>
144
+ {!!currentMessage.sent && (<Text style={[styles.content.tick, props.tickStyle]}>
141
145
  {'✓'}
142
146
  </Text>)}
143
- {!!currentMessage.received && (<Text style={[styles.content.tick, this.props.tickStyle]}>
147
+ {!!currentMessage.received && (<Text style={[styles.content.tick, props.tickStyle]}>
144
148
  {'✓'}
145
149
  </Text>)}
146
- {!!currentMessage.pending && (<Text style={[styles.content.tick, this.props.tickStyle]}>
150
+ {!!currentMessage.pending && (<Text style={[styles.content.tick, props.tickStyle]}>
147
151
  {'🕓'}
148
152
  </Text>)}
149
153
  </View>);
150
154
  return null;
151
- }
152
- renderTime() {
153
- if (this.props.currentMessage?.createdAt) {
155
+ }, [
156
+ props,
157
+ currentMessage,
158
+ ]);
159
+ const renderTime = useCallback(() => {
160
+ if (currentMessage?.createdAt) {
154
161
  const {
155
162
  /* eslint-disable @typescript-eslint/no-unused-vars */
156
163
  containerStyle, wrapperStyle, textStyle,
157
164
  /* eslint-enable @typescript-eslint/no-unused-vars */
158
- ...timeProps } = this.props;
159
- if (this.props.renderTime)
160
- return this.props.renderTime(timeProps);
165
+ ...timeProps } = props;
166
+ if (props.renderTime)
167
+ return props.renderTime(timeProps);
161
168
  return <Time {...timeProps}/>;
162
169
  }
163
170
  return null;
164
- }
165
- renderUsername() {
166
- const { currentMessage, user, renderUsername, } = this.props;
167
- if (this.props.renderUsernameOnMessage && currentMessage) {
171
+ }, [props, currentMessage]);
172
+ const renderUsername = useCallback(() => {
173
+ const { user, renderUsername, } = props;
174
+ if (props.renderUsernameOnMessage && currentMessage) {
168
175
  if (user && currentMessage.user._id === user._id)
169
176
  return null;
170
177
  if (renderUsername)
171
178
  return renderUsername(currentMessage.user);
172
179
  return (<View style={styles.content.usernameView}>
173
- <Text style={[styles.content.username, this.props.usernameStyle]}>
180
+ <Text style={[styles.content.username, props.usernameStyle]}>
174
181
  {'~ '}
175
182
  {currentMessage.user.name}
176
183
  </Text>
177
184
  </View>);
178
185
  }
179
186
  return null;
180
- }
181
- renderCustomView() {
182
- if (this.props.renderCustomView)
183
- return this.props.renderCustomView(this.props);
187
+ }, [
188
+ currentMessage,
189
+ props,
190
+ ]);
191
+ const renderCustomView = useCallback(() => {
192
+ if (props.renderCustomView)
193
+ return props.renderCustomView(props);
184
194
  return null;
185
- }
186
- renderBubbleContent() {
195
+ }, [props]);
196
+ const renderBubbleContent = useCallback(() => {
187
197
  return (<View>
188
- {!this.props.isCustomViewBottom && this.renderCustomView()}
189
- {this.renderMessageImage()}
190
- {this.renderMessageVideo()}
191
- {this.renderMessageAudio()}
192
- {this.renderMessageText()}
193
- {this.props.isCustomViewBottom && this.renderCustomView()}
198
+ {!props.isCustomViewBottom && renderCustomView()}
199
+ {renderMessageImage()}
200
+ {renderMessageVideo()}
201
+ {renderMessageAudio()}
202
+ {renderMessageText()}
203
+ {props.isCustomViewBottom && renderCustomView()}
194
204
  </View>);
195
- }
196
- render() {
197
- const { position, containerStyle, wrapperStyle, bottomContainerStyle, } = this.props;
198
- return (<View style={[
199
- stylesCommon.fill,
200
- styles[position].container,
201
- containerStyle && containerStyle[position],
202
- ]}>
203
- <View style={[
204
- styles[position].wrapper,
205
- this.styledBubbleToNext(),
206
- this.styledBubbleToPrevious(),
207
- wrapperStyle && wrapperStyle[position],
208
- ]}>
209
- <TouchableWithoutFeedback onPress={this.onPress} onLongPress={this.onLongPress} accessibilityRole='text' {...this.props.touchableProps}>
210
- <View>
211
- {this.renderBubbleContent()}
212
- <View style={[
213
- styles[position].bottom,
214
- bottomContainerStyle && bottomContainerStyle[position],
215
- ]}>
216
- {this.renderUsername()}
217
- {this.renderTime()}
218
- {this.renderTicks()}
219
- </View>
205
+ }, [
206
+ renderCustomView,
207
+ renderMessageImage,
208
+ renderMessageVideo,
209
+ renderMessageAudio,
210
+ renderMessageText,
211
+ props.isCustomViewBottom,
212
+ ]);
213
+ return (<View style={[
214
+ stylesCommon.fill,
215
+ styles[position].container,
216
+ containerStyle && containerStyle[position],
217
+ ]}>
218
+ <View style={[
219
+ styles[position].wrapper,
220
+ styledBubbleToNext(),
221
+ styledBubbleToPrevious(),
222
+ wrapperStyle && wrapperStyle[position],
223
+ ]}>
224
+ <TouchableWithoutFeedback onPress={onPress} onLongPress={onLongPress} accessibilityRole='text' {...props.touchableProps}>
225
+ <View>
226
+ {renderBubbleContent()}
227
+ <View style={[
228
+ styles[position].bottom,
229
+ bottomContainerStyle?.[position],
230
+ ]}>
231
+ {renderUsername()}
232
+ {renderTime()}
233
+ {renderTicks()}
220
234
  </View>
221
- </TouchableWithoutFeedback>
222
- </View>
223
- {this.renderQuickReplies()}
224
- </View>);
225
- }
226
- }
227
- Bubble.contextType = GiftedChatContext;
235
+ </View>
236
+ </TouchableWithoutFeedback>
237
+ </View>
238
+ {renderQuickReplies()}
239
+ </View>);
240
+ };
228
241
  export default Bubble;
229
242
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Bubble/index.tsx"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,CAEF;MAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO;YACxB,kBAAkB,EAAE;YACpB,sBAAsB,EAAE;YACxB,YAAY,IAAI,YAAY,CAAC,QAAQ,CAAC;SACvC,CAAC,CAEF;QAAA,CAAC,wBAAwB,CACvB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,iBAAiB,CAAC,MAAM,CACxB,IAAI,KAAK,CAAC,cAAc,CAAC,CAEzB;UAAA,CAAC,IAAI,CACH;YAAA,CAAC,mBAAmB,EAAE,CACtB;YAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM;YACvB,oBAAoB,EAAE,CAAC,QAAQ,CAAC;SACjC,CAAC,CAEF;cAAA,CAAC,cAAc,EAAE,CACjB;cAAA,CAAC,UAAU,EAAE,CACb;cAAA,CAAC,WAAW,EAAE,CAChB;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,wBAAwB,CAC5B;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,kBAAkB,EAAE,CACvB;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { StyleProp, ViewStyle, TextStyle } from 'react-native';
3
3
  import { QuickRepliesProps } from '../QuickReplies';
4
- import { MessageTextProps } from '../MessageText';
4
+ import { MessageTextProps, MessageOption } from '../MessageText';
5
5
  import { MessageImageProps } from '../MessageImage';
6
6
  import { TimeProps } from '../Time';
7
7
  import { User, IMessage, LeftRightStyle, Reply, Omit, MessageVideoProps, MessageAudioProps } from '../types';
8
8
  export type RenderMessageImageProps<TMessage extends IMessage> = Omit<BubbleProps<TMessage>, 'containerStyle' | 'wrapperStyle'> & MessageImageProps<TMessage>;
9
9
  export type RenderMessageVideoProps<TMessage extends IMessage> = Omit<BubbleProps<TMessage>, 'containerStyle' | 'wrapperStyle'> & MessageVideoProps<TMessage>;
10
10
  export type RenderMessageAudioProps<TMessage extends IMessage> = Omit<BubbleProps<TMessage>, 'containerStyle' | 'wrapperStyle'> & MessageAudioProps<TMessage>;
11
- export type RenderMessageTextProps<TMessage extends IMessage> = Omit<BubbleProps<TMessage>, 'containerStyle' | 'wrapperStyle'> & MessageTextProps<TMessage>;
11
+ export type RenderMessageTextProps<TMessage extends IMessage> = Omit<BubbleProps<TMessage>, 'containerStyle' | 'wrapperStyle' | 'options'> & MessageTextProps<TMessage>;
12
12
  export interface BubbleProps<TMessage extends IMessage> {
13
13
  user?: User;
14
14
  touchableProps?: object;
@@ -19,7 +19,7 @@ export interface BubbleProps<TMessage extends IMessage> {
19
19
  currentMessage: TMessage;
20
20
  nextMessage?: TMessage;
21
21
  previousMessage?: TMessage;
22
- optionTitles?: string[];
22
+ options?: MessageOption[];
23
23
  containerStyle?: LeftRightStyle<ViewStyle>;
24
24
  wrapperStyle?: LeftRightStyle<ViewStyle>;
25
25
  textStyle?: LeftRightStyle<TextStyle>;
@@ -35,7 +35,7 @@ function GiftedChat(props) {
35
35
  ios: 'never',
36
36
  android: 'always',
37
37
  default: 'never',
38
- }), onInputTextChanged = null, maxInputLength = null, inverted = true, minComposerHeight = MIN_COMPOSER_HEIGHT, maxComposerHeight = MAX_COMPOSER_HEIGHT, isKeyboardInternallyHandled = true, } = props;
38
+ }), onInputTextChanged = null, maxInputLength = null, inverted = true, minComposerHeight = MIN_COMPOSER_HEIGHT, maxComposerHeight = MAX_COMPOSER_HEIGHT, isKeyboardInternallyHandled = true, disableKeyboardController = false, } = props;
39
39
  const actionSheetRef = useRef(null);
40
40
  const messageContainerRef = useMemo(() => props.messageContainerRef || createRef(), [props.messageContainerRef]);
41
41
  const textInputRef = useMemo(() => props.textInputRef || createRef(), [props.textInputRef]);
@@ -44,7 +44,14 @@ function GiftedChat(props) {
44
44
  const [composerHeight, setComposerHeight] = useState(minComposerHeight);
45
45
  const [text, setText] = useState(() => props.text || '');
46
46
  const [isTypingDisabled, setIsTypingDisabled] = useState(false);
47
- const keyboard = useReanimatedKeyboardAnimation();
47
+ // Always call the hook, but conditionally use its data
48
+ const keyboardControllerData = useReanimatedKeyboardAnimation();
49
+ // Create a mock keyboard object when disabled
50
+ const keyboard = useMemo(() => {
51
+ if (disableKeyboardController)
52
+ return { height: { value: 0 } };
53
+ return keyboardControllerData;
54
+ }, [disableKeyboardController, keyboardControllerData]);
48
55
  const trackingKeyboardMovement = useSharedValue(false);
49
56
  const debounceEnableTypingTimeoutId = useRef(undefined);
50
57
  const keyboardOffsetBottom = useSharedValue(0);
@@ -231,7 +238,11 @@ function GiftedChat(props) {
231
238
  if (props.text != null)
232
239
  setText(props.text);
233
240
  }, [props.text]);
234
- useAnimatedReaction(() => -keyboard.height.value, (value, prevValue) => {
241
+ // Only set up keyboard animation when keyboard controller is enabled
242
+ useAnimatedReaction(() => disableKeyboardController ? 0 : -keyboard.height.value, (value, prevValue) => {
243
+ // Skip keyboard handling when disabled
244
+ if (disableKeyboardController)
245
+ return;
235
246
  if (prevValue !== null && value !== prevValue) {
236
247
  const isKeyboardMovingUp = value > prevValue;
237
248
  if (isKeyboardMovingUp !== trackingKeyboardMovement.value) {
@@ -264,12 +275,13 @@ function GiftedChat(props) {
264
275
  disableTyping,
265
276
  debounceEnableTyping,
266
277
  bottomOffset,
278
+ disableKeyboardController,
267
279
  ]);
268
280
  return (<GiftedChatContext.Provider value={contextValues}>
269
281
  <ActionSheetProvider ref={actionSheetRef}>
270
282
  <View testID={TEST_ID.WRAPPER} style={[stylesCommon.fill, styles.contentContainer]} onLayout={onInitialLayoutViewLayout}>
271
283
  {isInitialized
272
- ? (<Animated.View style={[stylesCommon.fill, isKeyboardInternallyHandled && contentStyleAnim]}>
284
+ ? (<Animated.View style={[stylesCommon.fill, (isKeyboardInternallyHandled && !disableKeyboardController) && contentStyleAnim]}>
273
285
  {renderMessages}
274
286
  {inputToolbarFragment}
275
287
  </Animated.View>)
@@ -279,6 +291,9 @@ function GiftedChat(props) {
279
291
  </GiftedChatContext.Provider>);
280
292
  }
281
293
  function GiftedChatWrapper(props) {
294
+ // Don't use KeyboardProvider when keyboard controller is disabled
295
+ if (props.disableKeyboardController)
296
+ return <GiftedChat {...props}/>;
282
297
  return (<KeyboardProvider>
283
298
  <GiftedChat {...props}/>
284
299
  </KeyboardProvider>);