react-native-gifted-chat 2.6.1 → 2.6.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/README.md +8 -13
- package/example_bare/vendor/bundle/ruby/2.7.0/gems/ffi-1.17.0/ext/ffi_c/libffi/.ci/compile +351 -0
- package/example_bare/vendor/bundle/ruby/2.7.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- package/lib/Avatar.js +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Bubble.d.ts +8 -8
- package/lib/GiftedAvatar.d.ts +3 -20
- package/lib/GiftedAvatar.js +58 -77
- package/lib/GiftedAvatar.js.map +1 -1
- package/lib/GiftedChat.d.ts +3 -1
- package/lib/GiftedChat.js +5 -4
- package/lib/GiftedChat.js.map +1 -1
- package/lib/Message.d.ts +3 -3
- package/lib/MessageContainer.d.ts +5 -5
- package/lib/MessageContainer.js +0 -2
- package/lib/MessageContainer.js.map +1 -1
- package/package.json +3 -2
- package/src/Avatar.tsx +1 -1
- package/src/GiftedAvatar.tsx +87 -91
- package/src/GiftedChat.tsx +9 -3
- package/src/MessageContainer.tsx +0 -3
package/README.md
CHANGED
|
@@ -79,10 +79,6 @@
|
|
|
79
79
|
</p>
|
|
80
80
|
</p>
|
|
81
81
|
|
|
82
|
-
## The future of GiftedChat 🎉
|
|
83
|
-
|
|
84
|
-
Please give us your advice: [Related PR](https://github.com/FaridSafi/react-native-gifted-chat/pull/1775)
|
|
85
|
-
|
|
86
82
|
## Features
|
|
87
83
|
|
|
88
84
|
- 🎉 **_`react-native-web`able_ (since 0.10.0)** [web configuration](#react-native-web)
|
|
@@ -101,12 +97,6 @@ Please give us your advice: [Related PR](https://github.com/FaridSafi/react-nati
|
|
|
101
97
|
- Quick Reply messages (bot)
|
|
102
98
|
- Typing indicator
|
|
103
99
|
|
|
104
|
-
## Dependency
|
|
105
|
-
|
|
106
|
-
- Use version `0.2.x` for RN `>= 0.44.0`
|
|
107
|
-
- Use version `0.1.x` for RN `>= 0.40.0`
|
|
108
|
-
- Use version `0.0.10` for RN `< 0.40.0`
|
|
109
|
-
|
|
110
100
|
# Getting started
|
|
111
101
|
|
|
112
102
|
## Installation
|
|
@@ -115,18 +105,18 @@ Please give us your advice: [Related PR](https://github.com/FaridSafi/react-nati
|
|
|
115
105
|
|
|
116
106
|
Yarn:
|
|
117
107
|
```bash
|
|
118
|
-
yarn add react-native-gifted-chat react-native-reanimated react-native-safe-area-context
|
|
108
|
+
yarn add react-native-gifted-chat react-native-reanimated react-native-safe-area-context react-native-get-random-values
|
|
119
109
|
```
|
|
120
110
|
|
|
121
111
|
Npm:
|
|
122
112
|
|
|
123
113
|
```bash
|
|
124
|
-
npm install --save react-native-gifted-chat react-native-reanimated react-native-safe-area-context
|
|
114
|
+
npm install --save react-native-gifted-chat react-native-reanimated react-native-safe-area-context react-native-get-random-values
|
|
125
115
|
```
|
|
126
116
|
|
|
127
117
|
Expo
|
|
128
118
|
```bash
|
|
129
|
-
npx expo install react-native-gifted-chat react-native-reanimated react-native-safe-area-context
|
|
119
|
+
npx expo install react-native-gifted-chat react-native-reanimated react-native-safe-area-context react-native-get-random-values
|
|
130
120
|
```
|
|
131
121
|
|
|
132
122
|
### Non-expo users
|
|
@@ -139,6 +129,10 @@ npx pod-install
|
|
|
139
129
|
|
|
140
130
|
Follow guide: [react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context?tab=readme-ov-file#api)
|
|
141
131
|
|
|
132
|
+
### Setup react-native-reanimated
|
|
133
|
+
|
|
134
|
+
Follow guide: [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-2-add-reanimateds-babel-plugin)
|
|
135
|
+
|
|
142
136
|
### react-native-video and expo-av
|
|
143
137
|
|
|
144
138
|
- Both dependencies are removed since `0.11.0`.
|
|
@@ -405,6 +399,7 @@ interface QuickReplies {
|
|
|
405
399
|
- **`renderSend`** _(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))
|
|
406
400
|
- **`renderAccessory`** _(Function)_ - Custom second line of actions below the message composer
|
|
407
401
|
- **`onPressActionButton`** _(Function)_ - Callback when the Action button is pressed (if set, the default `actionSheet` will not be used)
|
|
402
|
+
- **`bottomOffset`** _(Integer)_ - Distance of the chat from the bottom of the screen (e.g. useful if you display a tab bar)
|
|
408
403
|
- **`minInputToolbarHeight`** _(Integer)_ - Minimum height of the input toolbar; default is `44`
|
|
409
404
|
- **`listViewProps`** _(Object)_ - Extra props to be passed to the messages [`<ListView>`](https://facebook.github.io/react-native/docs/listview.html); some props can't be overridden, see the code in `MessageContainer.render()` for details
|
|
410
405
|
- **`textInputProps`** _(Object)_ - Extra props to be passed to the [`<TextInput>`](https://facebook.github.io/react-native/docs/textinput.html)
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
# Wrapper for compilers which do not understand '-c -o'.
|
|
3
|
+
|
|
4
|
+
scriptversion=2018-03-27.18; # UTC
|
|
5
|
+
|
|
6
|
+
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
|
7
|
+
# Written by Tom Tromey <tromey@cygnus.com>.
|
|
8
|
+
#
|
|
9
|
+
# This program is free software; you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
|
11
|
+
# the Free Software Foundation; either version 2, or (at your option)
|
|
12
|
+
# any later version.
|
|
13
|
+
#
|
|
14
|
+
# This program is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
# As a special exception to the GNU General Public License, if you
|
|
23
|
+
# distribute this file as part of a program that contains a
|
|
24
|
+
# configuration script generated by Autoconf, you may include it under
|
|
25
|
+
# the same distribution terms that you use for the rest of that program.
|
|
26
|
+
|
|
27
|
+
# This file is maintained in Automake, please report
|
|
28
|
+
# bugs to <bug-automake@gnu.org> or send patches to
|
|
29
|
+
# <automake-patches@gnu.org>.
|
|
30
|
+
|
|
31
|
+
nl='
|
|
32
|
+
'
|
|
33
|
+
|
|
34
|
+
# We need space, tab and new line, in precisely that order. Quoting is
|
|
35
|
+
# there to prevent tools from complaining about whitespace usage.
|
|
36
|
+
IFS=" "" $nl"
|
|
37
|
+
|
|
38
|
+
file_conv=
|
|
39
|
+
|
|
40
|
+
# func_file_conv build_file lazy
|
|
41
|
+
# Convert a $build file to $host form and store it in $file
|
|
42
|
+
# Currently only supports Windows hosts. If the determined conversion
|
|
43
|
+
# type is listed in (the comma separated) LAZY, no conversion will
|
|
44
|
+
# take place.
|
|
45
|
+
func_file_conv ()
|
|
46
|
+
{
|
|
47
|
+
file=$1
|
|
48
|
+
case $file in
|
|
49
|
+
/ | /[!/]*) # absolute file, and not a UNC file
|
|
50
|
+
if test -z "$file_conv"; then
|
|
51
|
+
# lazily determine how to convert abs files
|
|
52
|
+
case `uname -s` in
|
|
53
|
+
MINGW*)
|
|
54
|
+
file_conv=mingw
|
|
55
|
+
;;
|
|
56
|
+
CYGWIN*)
|
|
57
|
+
file_conv=cygwin
|
|
58
|
+
;;
|
|
59
|
+
*)
|
|
60
|
+
file_conv=wine
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
fi
|
|
64
|
+
case $file_conv/,$2, in
|
|
65
|
+
*,$file_conv,*)
|
|
66
|
+
;;
|
|
67
|
+
mingw/*)
|
|
68
|
+
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
|
69
|
+
;;
|
|
70
|
+
cygwin/*)
|
|
71
|
+
file=`cygpath -m "$file" || echo "$file"`
|
|
72
|
+
;;
|
|
73
|
+
wine/*)
|
|
74
|
+
file=`winepath -w "$file" || echo "$file"`
|
|
75
|
+
;;
|
|
76
|
+
esac
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# func_cl_dashL linkdir
|
|
82
|
+
# Make cl look for libraries in LINKDIR
|
|
83
|
+
func_cl_dashL ()
|
|
84
|
+
{
|
|
85
|
+
func_file_conv "$1"
|
|
86
|
+
if test -z "$lib_path"; then
|
|
87
|
+
lib_path=$file
|
|
88
|
+
else
|
|
89
|
+
lib_path="$lib_path;$file"
|
|
90
|
+
fi
|
|
91
|
+
linker_opts="$linker_opts -LIBPATH:$file"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
# func_cl_dashl library
|
|
95
|
+
# Do a library search-path lookup for cl
|
|
96
|
+
func_cl_dashl ()
|
|
97
|
+
{
|
|
98
|
+
lib=$1
|
|
99
|
+
found=no
|
|
100
|
+
save_IFS=$IFS
|
|
101
|
+
IFS=';'
|
|
102
|
+
for dir in $lib_path $LIB
|
|
103
|
+
do
|
|
104
|
+
IFS=$save_IFS
|
|
105
|
+
if $shared && test -f "$dir/$lib.dll.lib"; then
|
|
106
|
+
found=yes
|
|
107
|
+
lib=$dir/$lib.dll.lib
|
|
108
|
+
break
|
|
109
|
+
fi
|
|
110
|
+
if test -f "$dir/$lib.lib"; then
|
|
111
|
+
found=yes
|
|
112
|
+
lib=$dir/$lib.lib
|
|
113
|
+
break
|
|
114
|
+
fi
|
|
115
|
+
if test -f "$dir/lib$lib.a"; then
|
|
116
|
+
found=yes
|
|
117
|
+
lib=$dir/lib$lib.a
|
|
118
|
+
break
|
|
119
|
+
fi
|
|
120
|
+
done
|
|
121
|
+
IFS=$save_IFS
|
|
122
|
+
|
|
123
|
+
if test "$found" != yes; then
|
|
124
|
+
lib=$lib.lib
|
|
125
|
+
fi
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# func_cl_wrapper cl arg...
|
|
129
|
+
# Adjust compile command to suit cl
|
|
130
|
+
func_cl_wrapper ()
|
|
131
|
+
{
|
|
132
|
+
# Assume a capable shell
|
|
133
|
+
lib_path=
|
|
134
|
+
shared=:
|
|
135
|
+
linker_opts=
|
|
136
|
+
for arg
|
|
137
|
+
do
|
|
138
|
+
if test -n "$eat"; then
|
|
139
|
+
eat=
|
|
140
|
+
else
|
|
141
|
+
case $1 in
|
|
142
|
+
-o)
|
|
143
|
+
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
144
|
+
eat=1
|
|
145
|
+
case $2 in
|
|
146
|
+
*.o | *.[oO][bB][jJ])
|
|
147
|
+
func_file_conv "$2"
|
|
148
|
+
set x "$@" -Fo"$file"
|
|
149
|
+
shift
|
|
150
|
+
;;
|
|
151
|
+
*)
|
|
152
|
+
func_file_conv "$2"
|
|
153
|
+
set x "$@" -Fe"$file"
|
|
154
|
+
shift
|
|
155
|
+
;;
|
|
156
|
+
esac
|
|
157
|
+
;;
|
|
158
|
+
-I)
|
|
159
|
+
eat=1
|
|
160
|
+
func_file_conv "$2" mingw
|
|
161
|
+
set x "$@" -I"$file"
|
|
162
|
+
shift
|
|
163
|
+
;;
|
|
164
|
+
-I*)
|
|
165
|
+
func_file_conv "${1#-I}" mingw
|
|
166
|
+
set x "$@" -I"$file"
|
|
167
|
+
shift
|
|
168
|
+
;;
|
|
169
|
+
-l)
|
|
170
|
+
eat=1
|
|
171
|
+
func_cl_dashl "$2"
|
|
172
|
+
set x "$@" "$lib"
|
|
173
|
+
shift
|
|
174
|
+
;;
|
|
175
|
+
-l*)
|
|
176
|
+
func_cl_dashl "${1#-l}"
|
|
177
|
+
set x "$@" "$lib"
|
|
178
|
+
shift
|
|
179
|
+
;;
|
|
180
|
+
-L)
|
|
181
|
+
eat=1
|
|
182
|
+
func_cl_dashL "$2"
|
|
183
|
+
;;
|
|
184
|
+
-L*)
|
|
185
|
+
func_cl_dashL "${1#-L}"
|
|
186
|
+
;;
|
|
187
|
+
-static)
|
|
188
|
+
shared=false
|
|
189
|
+
;;
|
|
190
|
+
-warn)
|
|
191
|
+
eat=1
|
|
192
|
+
;;
|
|
193
|
+
-Wl,*)
|
|
194
|
+
arg=${1#-Wl,}
|
|
195
|
+
save_ifs="$IFS"; IFS=','
|
|
196
|
+
for flag in $arg; do
|
|
197
|
+
IFS="$save_ifs"
|
|
198
|
+
linker_opts="$linker_opts $flag"
|
|
199
|
+
done
|
|
200
|
+
IFS="$save_ifs"
|
|
201
|
+
;;
|
|
202
|
+
-Xlinker)
|
|
203
|
+
eat=1
|
|
204
|
+
linker_opts="$linker_opts $2"
|
|
205
|
+
;;
|
|
206
|
+
-*)
|
|
207
|
+
set x "$@" "$1"
|
|
208
|
+
shift
|
|
209
|
+
;;
|
|
210
|
+
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
|
211
|
+
func_file_conv "$1"
|
|
212
|
+
set x "$@" -Tp"$file"
|
|
213
|
+
shift
|
|
214
|
+
;;
|
|
215
|
+
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
|
216
|
+
func_file_conv "$1" mingw
|
|
217
|
+
set x "$@" "$file"
|
|
218
|
+
shift
|
|
219
|
+
;;
|
|
220
|
+
*)
|
|
221
|
+
set x "$@" "$1"
|
|
222
|
+
shift
|
|
223
|
+
;;
|
|
224
|
+
esac
|
|
225
|
+
fi
|
|
226
|
+
shift
|
|
227
|
+
done
|
|
228
|
+
if test -n "$linker_opts"; then
|
|
229
|
+
linker_opts="-link$linker_opts"
|
|
230
|
+
fi
|
|
231
|
+
exec "$@" $linker_opts
|
|
232
|
+
exit 1
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
eat=
|
|
236
|
+
|
|
237
|
+
case $1 in
|
|
238
|
+
'')
|
|
239
|
+
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
|
240
|
+
exit 1;
|
|
241
|
+
;;
|
|
242
|
+
-h | --h*)
|
|
243
|
+
cat <<\EOF
|
|
244
|
+
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
|
245
|
+
|
|
246
|
+
Wrapper for compilers which do not understand '-c -o'.
|
|
247
|
+
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
|
248
|
+
arguments, and rename the output as expected.
|
|
249
|
+
|
|
250
|
+
If you are trying to build a whole package this is not the
|
|
251
|
+
right script to run: please start by reading the file 'INSTALL'.
|
|
252
|
+
|
|
253
|
+
Report bugs to <bug-automake@gnu.org>.
|
|
254
|
+
EOF
|
|
255
|
+
exit $?
|
|
256
|
+
;;
|
|
257
|
+
-v | --v*)
|
|
258
|
+
echo "compile $scriptversion"
|
|
259
|
+
exit $?
|
|
260
|
+
;;
|
|
261
|
+
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
|
262
|
+
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
|
263
|
+
func_cl_wrapper "$@" # Doesn't return...
|
|
264
|
+
;;
|
|
265
|
+
esac
|
|
266
|
+
|
|
267
|
+
ofile=
|
|
268
|
+
cfile=
|
|
269
|
+
|
|
270
|
+
for arg
|
|
271
|
+
do
|
|
272
|
+
if test -n "$eat"; then
|
|
273
|
+
eat=
|
|
274
|
+
else
|
|
275
|
+
case $1 in
|
|
276
|
+
-o)
|
|
277
|
+
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
|
278
|
+
# So we strip '-o arg' only if arg is an object.
|
|
279
|
+
eat=1
|
|
280
|
+
case $2 in
|
|
281
|
+
*.o | *.obj)
|
|
282
|
+
ofile=$2
|
|
283
|
+
;;
|
|
284
|
+
*)
|
|
285
|
+
set x "$@" -o "$2"
|
|
286
|
+
shift
|
|
287
|
+
;;
|
|
288
|
+
esac
|
|
289
|
+
;;
|
|
290
|
+
*.c)
|
|
291
|
+
cfile=$1
|
|
292
|
+
set x "$@" "$1"
|
|
293
|
+
shift
|
|
294
|
+
;;
|
|
295
|
+
*)
|
|
296
|
+
set x "$@" "$1"
|
|
297
|
+
shift
|
|
298
|
+
;;
|
|
299
|
+
esac
|
|
300
|
+
fi
|
|
301
|
+
shift
|
|
302
|
+
done
|
|
303
|
+
|
|
304
|
+
if test -z "$ofile" || test -z "$cfile"; then
|
|
305
|
+
# If no '-o' option was seen then we might have been invoked from a
|
|
306
|
+
# pattern rule where we don't need one. That is ok -- this is a
|
|
307
|
+
# normal compilation that the losing compiler can handle. If no
|
|
308
|
+
# '.c' file was seen then we are probably linking. That is also
|
|
309
|
+
# ok.
|
|
310
|
+
exec "$@"
|
|
311
|
+
fi
|
|
312
|
+
|
|
313
|
+
# Name of file we expect compiler to create.
|
|
314
|
+
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
|
315
|
+
|
|
316
|
+
# Create the lock directory.
|
|
317
|
+
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
|
318
|
+
# that we are using for the .o file. Also, base the name on the expected
|
|
319
|
+
# object file name, since that is what matters with a parallel build.
|
|
320
|
+
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
|
321
|
+
while true; do
|
|
322
|
+
if mkdir "$lockdir" >/dev/null 2>&1; then
|
|
323
|
+
break
|
|
324
|
+
fi
|
|
325
|
+
sleep 1
|
|
326
|
+
done
|
|
327
|
+
# FIXME: race condition here if user kills between mkdir and trap.
|
|
328
|
+
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
|
329
|
+
|
|
330
|
+
# Run the compile.
|
|
331
|
+
"$@"
|
|
332
|
+
ret=$?
|
|
333
|
+
|
|
334
|
+
if test -f "$cofile"; then
|
|
335
|
+
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
|
336
|
+
elif test -f "${cofile}bj"; then
|
|
337
|
+
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
|
338
|
+
fi
|
|
339
|
+
|
|
340
|
+
rmdir "$lockdir"
|
|
341
|
+
exit $ret
|
|
342
|
+
|
|
343
|
+
# Local Variables:
|
|
344
|
+
# mode: shell-script
|
|
345
|
+
# sh-indentation: 2
|
|
346
|
+
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
347
|
+
# time-stamp-start: "scriptversion="
|
|
348
|
+
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
349
|
+
# time-stamp-time-zone: "UTC0"
|
|
350
|
+
# time-stamp-end: "; # UTC"
|
|
351
|
+
# End:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
CC = gcc
|
|
2
|
+
CFLAGS = -O2 -Wall
|
|
3
|
+
prefix =
|
|
4
|
+
includedir = $(prefix)/include
|
|
5
|
+
libdir = $(prefix)/lib
|
|
6
|
+
CPPFLAGS = -I$(includedir)
|
|
7
|
+
LDFLAGS = -L$(libdir) -Wl,-rpath,$(libdir)
|
|
8
|
+
|
|
9
|
+
all: check-call check-callback
|
|
10
|
+
|
|
11
|
+
test-call: test-call.c testcases.c
|
|
12
|
+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-call test-call.c -lffi
|
|
13
|
+
|
|
14
|
+
test-callback: test-callback.c testcases.c
|
|
15
|
+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-callback test-callback.c -lffi
|
|
16
|
+
|
|
17
|
+
check-call: test-call
|
|
18
|
+
./test-call > test-call.out
|
|
19
|
+
LC_ALL=C uniq -u < test-call.out > failed-call
|
|
20
|
+
test '!' -s failed-call
|
|
21
|
+
|
|
22
|
+
check-callback: test-callback
|
|
23
|
+
./test-callback > test-callback.out
|
|
24
|
+
LC_ALL=C uniq -u < test-callback.out > failed-callback
|
|
25
|
+
test '!' -s failed-callback
|
|
26
|
+
|
|
27
|
+
clean:
|
|
28
|
+
rm -f test-call test-callback test-call.out test-callback.out failed-call failed-callback
|
package/lib/Avatar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { StyleSheet, View, } from 'react-native';
|
|
4
|
-
import GiftedAvatar from './GiftedAvatar';
|
|
4
|
+
import { GiftedAvatar } from './GiftedAvatar';
|
|
5
5
|
import { StylePropType, isSameUser, isSameDay } from './utils';
|
|
6
6
|
const styles = {
|
|
7
7
|
left: StyleSheet.create({
|
package/lib/Avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EAEL,UAAU,EAEV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,YAAY,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EAEL,UAAU,EAEV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAgB9D,MAAM,MAAM,GAAW;IACrB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;QACtB,SAAS,EAAE;YACT,WAAW,EAAE,CAAC;SACf;QACD,KAAK,EAAE;YACL,SAAS,EAAE,YAAY;SACxB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,EAAE;SACjB;KACF,CAAC;IACF,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,UAAU,EAAE,CAAC;SACd;QACD,KAAK,EAAE;YACL,SAAS,EAAE,YAAY;SACxB;QACD,KAAK,EAAE;YACL,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AAa;QACnB,KAAK,EAAE,aAAa;KACrB,CAAC;CACH,CAAA"}
|
package/lib/Bubble.d.ts
CHANGED
|
@@ -134,14 +134,14 @@ export default class Bubble<TMessage extends IMessage = IMessage> extends React.
|
|
|
134
134
|
} | {
|
|
135
135
|
borderTopRightRadius: number;
|
|
136
136
|
})[] | null;
|
|
137
|
-
renderQuickReplies(): string | number | boolean |
|
|
138
|
-
renderMessageText(): string | number | boolean |
|
|
139
|
-
renderMessageImage(): string | number | boolean |
|
|
140
|
-
renderMessageVideo(): string | number | boolean |
|
|
141
|
-
renderMessageAudio(): string | number | boolean |
|
|
142
|
-
renderTicks(): string | number | boolean |
|
|
143
|
-
renderTime(): string | number | boolean |
|
|
144
|
-
renderUsername(): string | number | boolean |
|
|
137
|
+
renderQuickReplies(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
138
|
+
renderMessageText(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
139
|
+
renderMessageImage(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
140
|
+
renderMessageVideo(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
141
|
+
renderMessageAudio(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
142
|
+
renderTicks(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
143
|
+
renderTime(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
144
|
+
renderUsername(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
145
145
|
renderCustomView(): React.ReactNode;
|
|
146
146
|
renderBubbleContent(): React.JSX.Element;
|
|
147
147
|
render(): React.JSX.Element;
|
package/lib/GiftedAvatar.d.ts
CHANGED
|
@@ -9,30 +9,13 @@ export interface GiftedAvatarProps {
|
|
|
9
9
|
onPress?: (props: GiftedAvatarProps) => void;
|
|
10
10
|
onLongPress?: (props: GiftedAvatarProps) => void;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
name: null;
|
|
16
|
-
avatar: null;
|
|
17
|
-
};
|
|
18
|
-
onPress: undefined;
|
|
19
|
-
onLongPress: undefined;
|
|
20
|
-
avatarStyle: {};
|
|
21
|
-
textStyle: {};
|
|
22
|
-
};
|
|
23
|
-
static propTypes: {
|
|
12
|
+
export declare function GiftedAvatar(props: GiftedAvatarProps): React.JSX.Element;
|
|
13
|
+
export declare namespace GiftedAvatar {
|
|
14
|
+
var propTypes: {
|
|
24
15
|
user: PropTypes.Requireable<object>;
|
|
25
16
|
onPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
17
|
onLongPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
18
|
avatarStyle: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
|
|
28
19
|
textStyle: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
|
|
29
20
|
};
|
|
30
|
-
avatarName?: string;
|
|
31
|
-
avatarColor?: string;
|
|
32
|
-
setAvatarColor(): void;
|
|
33
|
-
renderAvatar(): React.JSX.Element | null;
|
|
34
|
-
renderInitials(): React.JSX.Element;
|
|
35
|
-
handleOnPress: () => void;
|
|
36
|
-
handleOnLongPress: () => void;
|
|
37
|
-
render(): React.JSX.Element;
|
|
38
21
|
}
|
package/lib/GiftedAvatar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useCallback, useRef } from 'react';
|
|
3
3
|
import { Image, Text, TouchableOpacity, View, StyleSheet, } from 'react-native';
|
|
4
4
|
import Color from './Color';
|
|
5
5
|
import { StylePropType } from './utils';
|
|
@@ -22,39 +22,22 @@ const styles = StyleSheet.create({
|
|
|
22
22
|
fontWeight: '100',
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
35
|
-
...rest } = this.props;
|
|
36
|
-
if (this.props.onPress)
|
|
37
|
-
this.props.onPress(rest);
|
|
38
|
-
};
|
|
39
|
-
this.handleOnLongPress = () => {
|
|
40
|
-
const {
|
|
41
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
42
|
-
onLongPress,
|
|
43
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
44
|
-
...rest } = this.props;
|
|
45
|
-
if (this.props.onLongPress)
|
|
46
|
-
this.props.onLongPress(rest);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
setAvatarColor() {
|
|
50
|
-
const userName = (this.props.user && this.props.user.name) || '';
|
|
25
|
+
export function GiftedAvatar(props) {
|
|
26
|
+
const avatarNameRef = useRef(undefined);
|
|
27
|
+
const avatarColorRef = useRef(undefined);
|
|
28
|
+
const { user = {
|
|
29
|
+
name: null,
|
|
30
|
+
avatar: null,
|
|
31
|
+
}, avatarStyle = {}, textStyle = {}, onPress, } = props;
|
|
32
|
+
const setAvatarColor = useCallback(() => {
|
|
33
|
+
const userName = user.name || '';
|
|
51
34
|
const name = userName.toUpperCase().split(' ');
|
|
52
35
|
if (name.length === 1)
|
|
53
|
-
|
|
36
|
+
avatarNameRef.current = `${name[0].charAt(0)}`;
|
|
54
37
|
else if (name.length > 1)
|
|
55
|
-
|
|
38
|
+
avatarNameRef.current = `${name[0].charAt(0)}${name[1].charAt(0)}`;
|
|
56
39
|
else
|
|
57
|
-
|
|
40
|
+
avatarNameRef.current = '';
|
|
58
41
|
let sumChars = 0;
|
|
59
42
|
for (let i = 0; i < userName.length; i += 1)
|
|
60
43
|
sumChars += userName.charCodeAt(i);
|
|
@@ -69,56 +52,55 @@ class GiftedAvatar extends React.Component {
|
|
|
69
52
|
turquoise,
|
|
70
53
|
midnightBlue,
|
|
71
54
|
];
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
renderAvatar() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
55
|
+
avatarColorRef.current = colors[sumChars % colors.length];
|
|
56
|
+
}, [user.name]);
|
|
57
|
+
const renderAvatar = useCallback(() => {
|
|
58
|
+
switch (typeof user.avatar) {
|
|
59
|
+
case 'function':
|
|
60
|
+
return user.avatar([styles.avatarStyle, avatarStyle]);
|
|
61
|
+
case 'string':
|
|
62
|
+
return (<Image source={{ uri: user.avatar }} style={[styles.avatarStyle, avatarStyle]}/>);
|
|
63
|
+
case 'number':
|
|
64
|
+
return (<Image source={user.avatar} style={[styles.avatarStyle, avatarStyle]}/>);
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}, [user.name, user.avatar, avatarStyle]);
|
|
69
|
+
const renderInitials = useCallback(() => {
|
|
70
|
+
return (<Text style={[styles.textStyle, textStyle]}>
|
|
71
|
+
{avatarNameRef.current}
|
|
88
72
|
</Text>);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return (<TouchableOpacity disabled={!this.props.onPress} onPress={this.handleOnPress} onLongPress={this.handleOnLongPress} style={[
|
|
73
|
+
}, [textStyle]);
|
|
74
|
+
const handleOnPress = () => {
|
|
75
|
+
const { onPress, ...rest } = props;
|
|
76
|
+
if (onPress)
|
|
77
|
+
onPress(rest);
|
|
78
|
+
};
|
|
79
|
+
const handleOnLongPress = () => {
|
|
80
|
+
const { onLongPress, ...rest } = props;
|
|
81
|
+
if (onLongPress)
|
|
82
|
+
onLongPress(rest);
|
|
83
|
+
};
|
|
84
|
+
if (!user || (!user.name && !user.avatar))
|
|
85
|
+
// render placeholder
|
|
86
|
+
return (<View style={[
|
|
104
87
|
styles.avatarStyle,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
]} accessibilityRole='image'
|
|
108
|
-
|
|
88
|
+
styles.avatarTransparent,
|
|
89
|
+
avatarStyle,
|
|
90
|
+
]} accessibilityRole='image'/>);
|
|
91
|
+
if (user.avatar)
|
|
92
|
+
return (<TouchableOpacity disabled={!onPress} onPress={handleOnPress} onLongPress={handleOnLongPress} accessibilityRole='image'>
|
|
93
|
+
{renderAvatar()}
|
|
109
94
|
</TouchableOpacity>);
|
|
110
|
-
|
|
95
|
+
setAvatarColor();
|
|
96
|
+
return (<TouchableOpacity disabled={!onPress} onPress={handleOnPress} onLongPress={handleOnLongPress} style={[
|
|
97
|
+
styles.avatarStyle,
|
|
98
|
+
{ backgroundColor: avatarColorRef.current },
|
|
99
|
+
avatarStyle,
|
|
100
|
+
]} accessibilityRole='image'>
|
|
101
|
+
{renderInitials()}
|
|
102
|
+
</TouchableOpacity>);
|
|
111
103
|
}
|
|
112
|
-
GiftedAvatar.defaultProps = {
|
|
113
|
-
user: {
|
|
114
|
-
name: null,
|
|
115
|
-
avatar: null,
|
|
116
|
-
},
|
|
117
|
-
onPress: undefined,
|
|
118
|
-
onLongPress: undefined,
|
|
119
|
-
avatarStyle: {},
|
|
120
|
-
textStyle: {},
|
|
121
|
-
};
|
|
122
104
|
GiftedAvatar.propTypes = {
|
|
123
105
|
user: PropTypes.object,
|
|
124
106
|
onPress: PropTypes.func,
|
|
@@ -126,5 +108,4 @@ GiftedAvatar.propTypes = {
|
|
|
126
108
|
avatarStyle: StylePropType,
|
|
127
109
|
textStyle: StylePropType,
|
|
128
110
|
};
|
|
129
|
-
export default GiftedAvatar;
|
|
130
111
|
//# sourceMappingURL=GiftedAvatar.js.map
|
package/lib/GiftedAvatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftedAvatar.js","sourceRoot":"","sources":["../src/GiftedAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"GiftedAvatar.js","sourceRoot":"","sources":["../src/GiftedAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EACL,KAAK,EACL,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,UAAU,GAIX,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,YAAY,GACb,GAAG,KAAK,CAAA;AAET,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE;QACX,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;KACjB;IACD,iBAAiB,EAAE;QACjB,eAAe,EAAE,KAAK,CAAC,qBAAqB;KAC7C;IACD,SAAS,EAAE;QACT,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,KAAK,CAAC,qBAAqB;QAC5C,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAA;AAUF,MAAM,UAAU,YAAY,CAC1B,KAAwB;IAExB,MAAM,aAAa,GAAG,MAAM,CAAqB,SAAS,CAAC,CAAA;I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,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,aAAa;CACzB,CAAA"}
|
package/lib/GiftedChat.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Avatar, AvatarProps } from './Avatar';
|
|
|
7
7
|
import Bubble from './Bubble';
|
|
8
8
|
import { Composer, ComposerProps } from './Composer';
|
|
9
9
|
import { Day, DayProps } from './Day';
|
|
10
|
-
import GiftedAvatar from './GiftedAvatar';
|
|
10
|
+
import { GiftedAvatar } from './GiftedAvatar';
|
|
11
11
|
import { InputToolbar, InputToolbarProps } from './InputToolbar';
|
|
12
12
|
import { LoadEarlier, LoadEarlierProps } from './LoadEarlier';
|
|
13
13
|
import Message from './Message';
|
|
@@ -25,6 +25,7 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
|
25
25
|
textInputRef?: React.RefObject<TextInput>;
|
|
26
26
|
messages?: TMessage[];
|
|
27
27
|
isTyping?: boolean;
|
|
28
|
+
renderUsernameOnMessage?: boolean;
|
|
28
29
|
messagesContainerStyle?: StyleProp<ViewStyle>;
|
|
29
30
|
text?: string;
|
|
30
31
|
alignTop?: boolean;
|
|
@@ -45,6 +46,7 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
|
45
46
|
inverted?: boolean;
|
|
46
47
|
imageProps?: Message<TMessage>['props'];
|
|
47
48
|
lightboxProps?: LightboxProps;
|
|
49
|
+
bottomOffset?: number;
|
|
48
50
|
minInputToolbarHeight?: number;
|
|
49
51
|
listViewProps?: object;
|
|
50
52
|
textInputProps?: object;
|
package/lib/GiftedChat.js
CHANGED
|
@@ -10,7 +10,7 @@ import Bubble from './Bubble';
|
|
|
10
10
|
import { Composer } from './Composer';
|
|
11
11
|
import { MAX_COMPOSER_HEIGHT, MIN_COMPOSER_HEIGHT, TEST_ID } from './Constant';
|
|
12
12
|
import { Day } from './Day';
|
|
13
|
-
import GiftedAvatar from './GiftedAvatar';
|
|
13
|
+
import { GiftedAvatar } from './GiftedAvatar';
|
|
14
14
|
import { GiftedChatContext } from './GiftedChatContext';
|
|
15
15
|
import { InputToolbar } from './InputToolbar';
|
|
16
16
|
import { LoadEarlier } from './LoadEarlier';
|
|
@@ -26,7 +26,7 @@ import Animated, { useAnimatedKeyboard, useAnimatedStyle, useAnimatedReaction, u
|
|
|
26
26
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
27
27
|
dayjs.extend(localizedFormat);
|
|
28
28
|
function GiftedChat(props) {
|
|
29
|
-
const { messages = [], initialText = '', isTyping, messageIdGenerator = () => uuidv4(), user = {}, onSend, locale = 'en', renderLoading, actionSheet = null, textInputProps, renderChatFooter = null, renderInputToolbar = null, keyboardShouldPersistTaps = Platform.select({
|
|
29
|
+
const { messages = [], initialText = '', isTyping, messageIdGenerator = () => uuidv4(), user = {}, onSend, locale = 'en', renderLoading, actionSheet = null, textInputProps, renderChatFooter = null, renderInputToolbar = null, bottomOffset = 0, keyboardShouldPersistTaps = Platform.select({
|
|
30
30
|
ios: 'never',
|
|
31
31
|
android: 'always',
|
|
32
32
|
default: 'never',
|
|
@@ -234,8 +234,9 @@ function GiftedChat(props) {
|
|
|
234
234
|
const isKeyboardMovingUp = value > prevValue;
|
|
235
235
|
if (isKeyboardMovingUp !== trackingKeyboardMovement.value) {
|
|
236
236
|
trackingKeyboardMovement.value = isKeyboardMovingUp;
|
|
237
|
-
keyboardOffsetBottom.value = withTiming(isKeyboardMovingUp ? insets.bottom : 0, {
|
|
238
|
-
duration
|
|
237
|
+
keyboardOffsetBottom.value = withTiming(isKeyboardMovingUp ? insets.bottom + bottomOffset : 0, {
|
|
238
|
+
// If `bottomOffset` exists, we change the duration to a smaller value to fix the delay in the keyboard animation speed
|
|
239
|
+
duration: bottomOffset ? 150 : 400,
|
|
239
240
|
});
|
|
240
241
|
if (isKeyboardMovingUp)
|
|
241
242
|
runOnJS(handleTextInputFocusWhenKeyboardShow)();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AC,CAAA;AAED,UAAU,CAAC,OAAO,GAAG,CACnB,kBAA8B,EAAE,EAChC,QAAoB,EACpB,QAAQ,GAAG,IAAI,EACf,EAAE;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC1B,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAA;IAEvB,OAAO,QAAQ;QACb,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;KACR;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAA;AAEF,cAAc,UAAU,CAAA;AACxB,OAAO,EACL,UAAU,EACV,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,GAAG,EACH,YAAY,EACZ,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACN,CAAA"}
|
package/lib/Message.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ export default class Message<TMessage extends IMessage = IMessage> extends React
|
|
|
59
59
|
onMessageLayout: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
60
|
};
|
|
61
61
|
shouldComponentUpdate(nextProps: MessageProps<TMessage>): boolean;
|
|
62
|
-
renderDay(): string | number | boolean |
|
|
63
|
-
renderBubble(): string | number | boolean |
|
|
64
|
-
renderSystemMessage(): string | number | boolean |
|
|
62
|
+
renderDay(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
63
|
+
renderBubble(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
64
|
+
renderSystemMessage(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
65
65
|
renderAvatar(): React.JSX.Element | null;
|
|
66
66
|
render(): React.JSX.Element | null;
|
|
67
67
|
}
|
|
@@ -79,9 +79,9 @@ export default class MessageContainer<TMessage extends IMessage = IMessage> exte
|
|
|
79
79
|
showScrollBottom: boolean;
|
|
80
80
|
hasScrolled: boolean;
|
|
81
81
|
};
|
|
82
|
-
renderTypingIndicator: () => React.JSX.Element
|
|
83
|
-
renderFooter: () => string | number | boolean |
|
|
84
|
-
renderLoadEarlier: () => string | number | boolean |
|
|
82
|
+
renderTypingIndicator: () => React.JSX.Element;
|
|
83
|
+
renderFooter: () => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
84
|
+
renderLoadEarlier: () => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
85
85
|
scrollTo(options: {
|
|
86
86
|
animated?: boolean;
|
|
87
87
|
offset: number;
|
|
@@ -89,9 +89,9 @@ export default class MessageContainer<TMessage extends IMessage = IMessage> exte
|
|
|
89
89
|
scrollToBottom: (animated?: boolean) => void;
|
|
90
90
|
handleOnScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
91
91
|
renderRow: ({ item, index }: ListRenderItemInfo<TMessage>) => React.ReactElement | null;
|
|
92
|
-
renderChatEmpty: () => string | number | boolean |
|
|
92
|
+
renderChatEmpty: () => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
93
93
|
renderHeaderWrapper: () => React.JSX.Element;
|
|
94
|
-
renderScrollBottomComponent(): string | number | boolean |
|
|
94
|
+
renderScrollBottomComponent(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
95
95
|
renderScrollToBottomWrapper(): React.JSX.Element;
|
|
96
96
|
onLayoutList: () => void;
|
|
97
97
|
onEndReached: ({ distanceFromEnd }: {
|
package/lib/MessageContainer.js
CHANGED
|
@@ -55,8 +55,6 @@ class MessageContainer extends React.PureComponent {
|
|
|
55
55
|
hasScrolled: false,
|
|
56
56
|
};
|
|
57
57
|
this.renderTypingIndicator = () => {
|
|
58
|
-
if (Platform.OS === 'web')
|
|
59
|
-
return null;
|
|
60
58
|
return <TypingIndicator isTyping={this.props.isTyping || false}/>;
|
|
61
59
|
};
|
|
62
60
|
this.renderFooter = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContainer.js","sourceRoot":"","sources":["../src/MessageContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,IAAI,EAMJ,QAAQ,GACT,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAoB,MAAM,eAAe,CAAA;AAC7D,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,iBAAiB,EAAE;QACjB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,YAAY;KACzB;IACD,qBAAqB,EAAE;QACrB,QAAQ,EAAE,CAAC;QACX,cAAc,EAAE,YAAY;KAC7B;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;KAC5B;IACD,aAAa,EAAE;QACb,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,mBAAmB,E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AC,IAAI;IACxB,mBAAmB,EAAE,aAAa;IAClC,cAAc,EAAE,SAAS,CAAC,IAAI;CAC/B,AApBe,CAoBf;eA7CkB,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-chat",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "The most complete chat UI for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"lodash.isequal": "^4.5.0",
|
|
58
58
|
"prop-types": "^15.8.1",
|
|
59
59
|
"react-native-communications": "^2.2.1",
|
|
60
|
-
"react-native-get-random-values": "^1.11.0",
|
|
61
60
|
"react-native-iphone-x-helper": "^1.3.1",
|
|
62
61
|
"react-native-lightbox-v2": "^0.9.0",
|
|
63
62
|
"react-native-parsed-text": "^0.0.22",
|
|
@@ -96,6 +95,7 @@
|
|
|
96
95
|
"react": "^18.3.1",
|
|
97
96
|
"react-dom": "^18.3.1",
|
|
98
97
|
"react-native": "^0.74.5",
|
|
98
|
+
"react-native-get-random-values": "^1.11.0",
|
|
99
99
|
"react-native-reanimated": "^3.15.0",
|
|
100
100
|
"react-native-safe-area-context": "^4.10.9",
|
|
101
101
|
"react-test-renderer": "^18.3.1",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"react": "*",
|
|
106
106
|
"react-native": "*",
|
|
107
|
+
"react-native-get-random-values": "*",
|
|
107
108
|
"react-native-reanimated": "*",
|
|
108
109
|
"react-native-safe-area-context": "*"
|
|
109
110
|
},
|
package/src/Avatar.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
ViewStyle,
|
|
9
9
|
} from 'react-native'
|
|
10
|
-
import GiftedAvatar from './GiftedAvatar'
|
|
10
|
+
import { GiftedAvatar } from './GiftedAvatar'
|
|
11
11
|
import { StylePropType, isSameUser, isSameDay } from './utils'
|
|
12
12
|
import { IMessage, LeftRightStyle, User } from './Models'
|
|
13
13
|
|
package/src/GiftedAvatar.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useCallback, useRef } from 'react'
|
|
3
3
|
import {
|
|
4
4
|
Image,
|
|
5
5
|
Text,
|
|
@@ -51,38 +51,32 @@ export interface GiftedAvatarProps {
|
|
|
51
51
|
onLongPress?: (props: GiftedAvatarProps) => void
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
export function GiftedAvatar (
|
|
55
|
+
props: GiftedAvatarProps
|
|
56
|
+
) {
|
|
57
|
+
const avatarNameRef = useRef<string | undefined>(undefined)
|
|
58
|
+
const avatarColorRef = useRef<string | undefined>(undefined)
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
user = {
|
|
57
62
|
name: null,
|
|
58
63
|
avatar: null,
|
|
59
64
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
static propTypes = {
|
|
67
|
-
user: PropTypes.object,
|
|
68
|
-
onPress: PropTypes.func,
|
|
69
|
-
onLongPress: PropTypes.func,
|
|
70
|
-
avatarStyle: StylePropType,
|
|
71
|
-
textStyle: StylePropType,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
avatarName?: string = undefined
|
|
75
|
-
avatarColor?: string = undefined
|
|
65
|
+
avatarStyle = {},
|
|
66
|
+
textStyle = {},
|
|
67
|
+
onPress,
|
|
68
|
+
} = props
|
|
76
69
|
|
|
77
|
-
setAvatarColor () {
|
|
78
|
-
const userName =
|
|
70
|
+
const setAvatarColor = useCallback(() => {
|
|
71
|
+
const userName = user.name || ''
|
|
79
72
|
const name = userName.toUpperCase().split(' ')
|
|
73
|
+
|
|
80
74
|
if (name.length === 1)
|
|
81
|
-
|
|
75
|
+
avatarNameRef.current = `${name[0].charAt(0)}`
|
|
82
76
|
else if (name.length > 1)
|
|
83
|
-
|
|
77
|
+
avatarNameRef.current = `${name[0].charAt(0)}${name[1].charAt(0)}`
|
|
84
78
|
else
|
|
85
|
-
|
|
79
|
+
avatarNameRef.current = ''
|
|
86
80
|
|
|
87
81
|
let sumChars = 0
|
|
88
82
|
for (let i = 0; i < userName.length; i += 1)
|
|
@@ -100,106 +94,108 @@ export default class GiftedAvatar extends React.Component<GiftedAvatarProps> {
|
|
|
100
94
|
midnightBlue,
|
|
101
95
|
]
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
}
|
|
97
|
+
avatarColorRef.current = colors[sumChars % colors.length]
|
|
98
|
+
}, [user.name])
|
|
105
99
|
|
|
106
|
-
renderAvatar () {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
else if (typeof user.avatar === 'string')
|
|
100
|
+
const renderAvatar = useCallback(() => {
|
|
101
|
+
switch (typeof user.avatar) {
|
|
102
|
+
case 'function':
|
|
103
|
+
return user.avatar([styles.avatarStyle, avatarStyle])
|
|
104
|
+
case 'string':
|
|
112
105
|
return (
|
|
113
106
|
<Image
|
|
114
107
|
source={{ uri: user.avatar }}
|
|
115
|
-
style={[styles.avatarStyle,
|
|
108
|
+
style={[styles.avatarStyle, avatarStyle]}
|
|
116
109
|
/>
|
|
117
110
|
)
|
|
118
|
-
|
|
111
|
+
case 'number':
|
|
119
112
|
return (
|
|
120
113
|
<Image
|
|
121
114
|
source={user.avatar}
|
|
122
|
-
style={[styles.avatarStyle,
|
|
115
|
+
style={[styles.avatarStyle, avatarStyle]}
|
|
123
116
|
/>
|
|
124
117
|
)
|
|
118
|
+
default:
|
|
119
|
+
return null
|
|
120
|
+
}
|
|
121
|
+
}, [user.name, user.avatar, avatarStyle])
|
|
125
122
|
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
renderInitials () {
|
|
123
|
+
const renderInitials = useCallback(() => {
|
|
130
124
|
return (
|
|
131
|
-
<Text style={[styles.textStyle,
|
|
132
|
-
{
|
|
125
|
+
<Text style={[styles.textStyle, textStyle]}>
|
|
126
|
+
{avatarNameRef.current}
|
|
133
127
|
</Text>
|
|
134
128
|
)
|
|
135
|
-
}
|
|
129
|
+
}, [textStyle])
|
|
136
130
|
|
|
137
|
-
handleOnPress = () => {
|
|
131
|
+
const handleOnPress = () => {
|
|
138
132
|
const {
|
|
139
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
140
133
|
onPress,
|
|
141
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
142
134
|
...rest
|
|
143
|
-
} =
|
|
135
|
+
} = props
|
|
144
136
|
|
|
145
|
-
if (
|
|
146
|
-
|
|
137
|
+
if (onPress)
|
|
138
|
+
onPress(rest)
|
|
147
139
|
}
|
|
148
140
|
|
|
149
|
-
handleOnLongPress = () => {
|
|
141
|
+
const handleOnLongPress = () => {
|
|
150
142
|
const {
|
|
151
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
152
143
|
onLongPress,
|
|
153
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
154
144
|
...rest
|
|
155
|
-
} =
|
|
145
|
+
} = props
|
|
156
146
|
|
|
157
|
-
if (
|
|
158
|
-
|
|
147
|
+
if (onLongPress)
|
|
148
|
+
onLongPress(rest)
|
|
159
149
|
}
|
|
160
150
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// render placeholder
|
|
164
|
-
return (
|
|
165
|
-
<View
|
|
166
|
-
style={[
|
|
167
|
-
styles.avatarStyle,
|
|
168
|
-
styles.avatarTransparent,
|
|
169
|
-
this.props.avatarStyle,
|
|
170
|
-
]}
|
|
171
|
-
accessibilityRole='image'
|
|
172
|
-
/>
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
if (this.props.user.avatar)
|
|
176
|
-
return (
|
|
177
|
-
<TouchableOpacity
|
|
178
|
-
disabled={!this.props.onPress}
|
|
179
|
-
onPress={this.handleOnPress}
|
|
180
|
-
onLongPress={this.handleOnLongPress}
|
|
181
|
-
accessibilityRole='image'
|
|
182
|
-
>
|
|
183
|
-
{this.renderAvatar()}
|
|
184
|
-
</TouchableOpacity>
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
this.setAvatarColor()
|
|
188
|
-
|
|
151
|
+
if (!user || (!user.name && !user.avatar))
|
|
152
|
+
// render placeholder
|
|
189
153
|
return (
|
|
190
|
-
<
|
|
191
|
-
disabled={!this.props.onPress}
|
|
192
|
-
onPress={this.handleOnPress}
|
|
193
|
-
onLongPress={this.handleOnLongPress}
|
|
154
|
+
<View
|
|
194
155
|
style={[
|
|
195
156
|
styles.avatarStyle,
|
|
196
|
-
|
|
197
|
-
|
|
157
|
+
styles.avatarTransparent,
|
|
158
|
+
avatarStyle,
|
|
198
159
|
]}
|
|
199
160
|
accessibilityRole='image'
|
|
161
|
+
/>
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
if (user.avatar)
|
|
165
|
+
return (
|
|
166
|
+
<TouchableOpacity
|
|
167
|
+
disabled={!onPress}
|
|
168
|
+
onPress={handleOnPress}
|
|
169
|
+
onLongPress={handleOnLongPress}
|
|
170
|
+
accessibilityRole='image'
|
|
200
171
|
>
|
|
201
|
-
{
|
|
172
|
+
{renderAvatar()}
|
|
202
173
|
</TouchableOpacity>
|
|
203
174
|
)
|
|
204
|
-
|
|
175
|
+
|
|
176
|
+
setAvatarColor()
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<TouchableOpacity
|
|
180
|
+
disabled={!onPress}
|
|
181
|
+
onPress={handleOnPress}
|
|
182
|
+
onLongPress={handleOnLongPress}
|
|
183
|
+
style={[
|
|
184
|
+
styles.avatarStyle,
|
|
185
|
+
{ backgroundColor: avatarColorRef.current },
|
|
186
|
+
avatarStyle,
|
|
187
|
+
]}
|
|
188
|
+
accessibilityRole='image'
|
|
189
|
+
>
|
|
190
|
+
{renderInitials()}
|
|
191
|
+
</TouchableOpacity>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
GiftedAvatar.propTypes = {
|
|
196
|
+
user: PropTypes.object,
|
|
197
|
+
onPress: PropTypes.func,
|
|
198
|
+
onLongPress: PropTypes.func,
|
|
199
|
+
avatarStyle: StylePropType,
|
|
200
|
+
textStyle: StylePropType,
|
|
205
201
|
}
|
package/src/GiftedChat.tsx
CHANGED
|
@@ -33,7 +33,7 @@ import Bubble from './Bubble'
|
|
|
33
33
|
import { Composer, ComposerProps } from './Composer'
|
|
34
34
|
import { MAX_COMPOSER_HEIGHT, MIN_COMPOSER_HEIGHT, TEST_ID } from './Constant'
|
|
35
35
|
import { Day, DayProps } from './Day'
|
|
36
|
-
import GiftedAvatar from './GiftedAvatar'
|
|
36
|
+
import { GiftedAvatar } from './GiftedAvatar'
|
|
37
37
|
import { GiftedChatContext } from './GiftedChatContext'
|
|
38
38
|
import { InputToolbar, InputToolbarProps } from './InputToolbar'
|
|
39
39
|
import { LoadEarlier, LoadEarlierProps } from './LoadEarlier'
|
|
@@ -75,6 +75,8 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
|
75
75
|
messages?: TMessage[]
|
|
76
76
|
/* Typing Indicator state */
|
|
77
77
|
isTyping?: boolean
|
|
78
|
+
/* Controls whether or not to show user.name property in the message bubble */
|
|
79
|
+
renderUsernameOnMessage?: boolean
|
|
78
80
|
/* Messages container style */
|
|
79
81
|
messagesContainerStyle?: StyleProp<ViewStyle>
|
|
80
82
|
/* Input text; default is undefined, but if specified, it will override GiftedChat's internal state */
|
|
@@ -113,6 +115,8 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
|
113
115
|
imageProps?: Message<TMessage>['props']
|
|
114
116
|
/* Extra props to be passed to the MessageImage's Lightbox */
|
|
115
117
|
lightboxProps?: LightboxProps
|
|
118
|
+
/* Distance of the chat from the bottom of the screen (e.g. useful if you display a tab bar); default is 0 */
|
|
119
|
+
bottomOffset?: number
|
|
116
120
|
/* Minimum height of the input toolbar; default is 44 */
|
|
117
121
|
minInputToolbarHeight?: number
|
|
118
122
|
/* Extra props to be passed to the messages <ListView>; some props can't be overridden, see the code in MessageContainer.render() for details */
|
|
@@ -244,6 +248,7 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
|
|
|
244
248
|
textInputProps,
|
|
245
249
|
renderChatFooter = null,
|
|
246
250
|
renderInputToolbar = null,
|
|
251
|
+
bottomOffset = 0,
|
|
247
252
|
keyboardShouldPersistTaps = Platform.select({
|
|
248
253
|
ios: 'never',
|
|
249
254
|
android: 'always',
|
|
@@ -556,9 +561,10 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
|
|
|
556
561
|
if (isKeyboardMovingUp !== trackingKeyboardMovement.value) {
|
|
557
562
|
trackingKeyboardMovement.value = isKeyboardMovingUp
|
|
558
563
|
keyboardOffsetBottom.value = withTiming(
|
|
559
|
-
isKeyboardMovingUp ? insets.bottom : 0,
|
|
564
|
+
isKeyboardMovingUp ? insets.bottom + bottomOffset : 0,
|
|
560
565
|
{
|
|
561
|
-
duration
|
|
566
|
+
// If `bottomOffset` exists, we change the duration to a smaller value to fix the delay in the keyboard animation speed
|
|
567
|
+
duration: bottomOffset ? 150 : 400,
|
|
562
568
|
}
|
|
563
569
|
)
|
|
564
570
|
|
package/src/MessageContainer.tsx
CHANGED