From d1ecfd7df455e36021429d06c8d09f7898079c1e Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Mon, 4 Nov 2024 20:44:49 +0530 Subject: [PATCH] fix: attachment picker image picker icon visibility as per dependency --- .../AttachmentPickerSelectionBar.tsx | 36 +++++++++++-------- package/src/components/Channel/Channel.tsx | 3 +- .../components/NativeAttachmentPicker.tsx | 9 ++++- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx b/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx index 881d366906..3ec04c79f8 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx @@ -27,8 +27,14 @@ export const AttachmentPickerSelectionBar = () => { setSelectedPicker, } = useAttachmentPickerContext(); - const { hasCameraPicker, hasFilePicker, imageUploads, pickFile, takeAndUploadImage } = - useMessageInputContext(); + const { + hasCameraPicker, + hasFilePicker, + hasImagePicker, + imageUploads, + pickFile, + takeAndUploadImage, + } = useMessageInputContext(); const { theme: { @@ -53,18 +59,20 @@ export const AttachmentPickerSelectionBar = () => { return ( - - - - - + {hasImagePicker ? ( + + + + + + ) : null} {hasFilePicker ? ( , id: 'File', onPressHandler: pickFile }); } - buttons.push({ icon: , id: 'Camera', onPressHandler: takeAndUploadImage }); + if (hasCameraPicker) { + buttons.push({ + icon: , + id: 'Camera', + onPressHandler: takeAndUploadImage, + }); + } return ( <>