File tree 3 files changed +27
-18
lines changed 3 files changed +27
-18
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,22 @@ Then using our Addons component in ChatScreen
112
112
``` javascript
113
113
import React from ' react'
114
114
import {ChatScreen as BaseChatScreen } from ' rn-firebase-chat'
115
- import {CameraView , useCamera } from ' rn-firebase-chat/src/addons/camera'
115
+ import {
116
+ CameraView ,
117
+ useCamera ,
118
+ VoiceRecorderModalRef ,
119
+ VoiceRecorderModal ,
120
+ } from ' rn-firebase-chat/src/addons' ;
116
121
117
122
...
118
123
119
124
export const ChatScreen: React .FC = () => {
120
125
const {onPressCamera , onPressGallery } = useCamera ()
126
+ const fileAttachmentRef = useRef< VoiceRecorderModalRef> (null );
127
+
128
+ const onPressAudio = useCallback (() => {
129
+ fileAttachmentRef .current ? .show ();
130
+ }, []);
121
131
return (
122
132
< BaseChatScreen
123
133
memberIds= {[partnerInfo .id ]}
@@ -127,9 +137,17 @@ export const ChatScreen: React.FC = () => {
127
137
hasGallery: true ,
128
138
onPressCamera,
129
139
onPressGallery,
140
+ renderLeftCustomView : () => (
141
+ < Button onPress= {onPressAudio} title= " Audio" color= " #000" / >
142
+ ),
130
143
}}
131
144
>
132
- {({onSend}) => (< CameraView onSend= {onSend} / > )}
145
+ {({onSend}) => (
146
+ < View>
147
+ < CameraView onSend= {onSend} / > )
148
+ < VoiceRecorderModal ref= {fileAttachmentRef} onSend= {onSend} / >
149
+ < / View>
150
+ }
133
151
< / BaseChatScreen>
134
152
)
135
153
}
Original file line number Diff line number Diff line change 63
63
"react-native-vision-camera" : " ^4.1.0" ,
64
64
"release-it" : " ^15.0.0" ,
65
65
"typescript" : " ^4.5.2" ,
66
- "uuid" : " ^10.0.0" ,
67
66
"react-native-audio-recorder-player" : " ^3.6.11" ,
68
67
"react-native-fs" : " ^2.20.0" ,
69
68
"react-native-get-random-values" : " ^1.11.0" ,
169
168
"react-native-gifted-chat" : " ^2.6.3" ,
170
169
"react-native-image-picker" : " ^7.1.2" ,
171
170
"react-native-reanimated" : " ^3.15.3" ,
172
- "react-native-safe-area-context" : " ^4.11.0" ,
173
- "react-native-audio-recorder-player" : " ^3.6.11" ,
174
- "react-native-fast-image" : " ^8.6.3" ,
175
- "react-native-fs" : " ^2.20.0" ,
176
- "react-native-svg" : " ^15.3.0" ,
177
- "react-native-uuid" : " ^2.0.2" ,
178
- "react-native-video" : " ^6.2.0" ,
179
- "react-native-vision-camera" : " ^4.1.0" ,
180
- "uuid" : " ^10.0.0"
171
+ "react-native-safe-area-context" : " ^4.11.0"
181
172
}
182
173
}
Original file line number Diff line number Diff line change @@ -8439,9 +8439,9 @@ react-native-parsed-text@^0.0.22:
8439
8439
prop-types "^15.7.x"
8440
8440
8441
8441
react-native-reanimated@^3.15.3 :
8442
- version "3.15.3 "
8443
- resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.15.3 .tgz#580b5c1cb5a9f85e44b2850640514513d76e350d "
8444
- integrity sha512-5QBk/7PZvZ98Adxm4MRyglwzsRzReTQIe4Hd2wbBBAZ68IC4OYKvsc8cPEjgx3/1mG8HgHFYhbcDe5U2RjeFqw ==
8442
+ version "3.15.5 "
8443
+ resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.15.5 .tgz#c92085f054ddfc37b2b5489b7eadfc74da33e1f7 "
8444
+ integrity sha512-admqeZ0w235vQqYPy+IUgmHu5gwKi9+b7AQRV1yIK3MbAMLYx+RY+tTUtx1CNE5X+rNZ6eSQssW5z77yTwIusg ==
8445
8445
dependencies :
8446
8446
" @babel/plugin-transform-arrow-functions" " ^7.0.0-0"
8447
8447
" @babel/plugin-transform-class-properties" " ^7.0.0-0"
@@ -8456,9 +8456,9 @@ react-native-reanimated@^3.15.3:
8456
8456
invariant "^2.2.4"
8457
8457
8458
8458
react-native-safe-area-context@^4.11.0 :
8459
- version "4.11.0 "
8460
- resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.11.0 .tgz#d45271363672dc1923ddb0ce5a6ad588e210c85d "
8461
- integrity sha512-Bg7bozxEB+ZS+H3tVYs5yY1cvxNXgR6nRQwpSMkYR9IN5CbxohLnSprrOPG/ostTCd4F6iCk0c51pExEhifSKQ ==
8459
+ version "4.11.1 "
8460
+ resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.11.1 .tgz#dae959f4512ca125f087a44c16b2c23de10b0e29 "
8461
+ integrity sha512-urF1m4nFiZFaWjsv2zj8J/hKvo4b2tJW+6CYU1mY4lKv1RwhG2eV8J/EHKuNlLhATZx3+6j7szrpHrQW2ZcAaQ ==
8462
8462
8463
8463
react-native-svg@^15.3.0 :
8464
8464
version "15.7.1"
You can’t perform that action at this time.
0 commit comments