Skip to content

Commit 115b21a

Browse files
committed
fix: attachment picker component usage
1 parent f16e476 commit 115b21a

File tree

1 file changed

+15
-66
lines changed

1 file changed

+15
-66
lines changed

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
1+
import React, { useCallback, useEffect, useState } from 'react';
22
import { Modal, SafeAreaView, StyleSheet, View } from 'react-native';
33

44
import {
@@ -62,11 +62,7 @@ import {
6262
NativeHandlers,
6363
} from '../../native';
6464
import { AIStates, useAIState } from '../AITypingIndicatorView';
65-
import { AttachmentPicker, AttachmentPickerProps } from '../AttachmentPicker/AttachmentPicker';
66-
import { AttachmentPickerError as DefaultAttachmentPickerError } from '../AttachmentPicker/components/AttachmentPickerError';
67-
import { AttachmentPickerErrorImage as DefaultAttachmentPickerErrorImage } from '../AttachmentPicker/components/AttachmentPickerErrorImage';
68-
import { AttachmentPickerIOSSelectMorePhotos as DefaultAttachmentPickerIOSSelectMorePhotos } from '../AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos';
69-
import { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent } from '../AttachmentPicker/components/ImageOverlaySelectedComponent';
65+
import { AttachmentPickerProps } from '../AttachmentPicker/AttachmentPicker';
7066
import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
7167
import { CreatePoll } from '../Poll/CreatePollContent';
7268

@@ -196,21 +192,10 @@ const messageComposerStateStoreSelector = (state: MessageComposerState) => ({
196192

197193
const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
198194
const {
199-
AttachmentPickerBottomSheetHandle,
200-
AttachmentPickerError = DefaultAttachmentPickerError,
201-
AttachmentPickerErrorImage = DefaultAttachmentPickerErrorImage,
202-
AttachmentPickerIOSSelectMorePhotos = DefaultAttachmentPickerIOSSelectMorePhotos,
203195
AttachmentPickerSelectionBar,
204-
ImageOverlaySelectedComponent = DefaultImageOverlaySelectedComponent,
205196
attachmentPickerBottomSheetHeight,
206-
attachmentPickerBottomSheetHandleHeight,
207-
attachmentPickerErrorButtonText,
208-
attachmentPickerErrorText,
209197
attachmentSelectionBarHeight,
210-
numberOfAttachmentImagesToLoadPerCall = 60,
211-
numberOfAttachmentPickerImageColumns = 3,
212198
bottomInset,
213-
bottomSheetRef,
214199
selectedPicker,
215200

216201
additionalTextInputProps,
@@ -289,37 +274,6 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
289274
},
290275
} = useTheme();
291276

292-
const attachmentPickerProps = useMemo(
293-
() => ({
294-
AttachmentPickerBottomSheetHandle,
295-
attachmentPickerBottomSheetHandleHeight,
296-
attachmentPickerBottomSheetHeight,
297-
AttachmentPickerError,
298-
attachmentPickerErrorButtonText,
299-
AttachmentPickerErrorImage,
300-
attachmentPickerErrorText,
301-
AttachmentPickerIOSSelectMorePhotos,
302-
attachmentSelectionBarHeight,
303-
ImageOverlaySelectedComponent,
304-
numberOfAttachmentImagesToLoadPerCall,
305-
numberOfAttachmentPickerImageColumns,
306-
}),
307-
[
308-
AttachmentPickerBottomSheetHandle,
309-
attachmentPickerBottomSheetHandleHeight,
310-
attachmentPickerBottomSheetHeight,
311-
AttachmentPickerError,
312-
attachmentPickerErrorButtonText,
313-
AttachmentPickerErrorImage,
314-
attachmentPickerErrorText,
315-
AttachmentPickerIOSSelectMorePhotos,
316-
attachmentSelectionBarHeight,
317-
ImageOverlaySelectedComponent,
318-
numberOfAttachmentImagesToLoadPerCall,
319-
numberOfAttachmentPickerImageColumns,
320-
],
321-
);
322-
323277
const { seconds: cooldownRemainingSeconds } = useCountdown(cooldownEndsAt);
324278

325279
/**
@@ -670,24 +624,19 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
670624
<View style={[styles.suggestionsListContainer, { bottom: height }, suggestionListContainer]}>
671625
<AutoCompleteSuggestionList />
672626
</View>
673-
{isImageMediaLibraryAvailable() ? (
674-
<>
675-
{selectedPicker ? (
676-
<View
677-
style={[
678-
{
679-
backgroundColor: white_smoke,
680-
height:
681-
attachmentPickerBottomSheetHeight + attachmentSelectionBarHeight - bottomInset,
682-
},
683-
attachmentSelectionBar,
684-
]}
685-
>
686-
<AttachmentPickerSelectionBar />
687-
</View>
688-
) : null}
689-
{/* <AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} /> */}
690-
</>
627+
{isImageMediaLibraryAvailable() && selectedPicker ? (
628+
<View
629+
style={[
630+
{
631+
backgroundColor: white_smoke,
632+
height:
633+
attachmentPickerBottomSheetHeight + attachmentSelectionBarHeight - bottomInset,
634+
},
635+
attachmentSelectionBar,
636+
]}
637+
>
638+
<AttachmentPickerSelectionBar />
639+
</View>
691640
) : null}
692641

693642
{showPollCreationDialog ? (

0 commit comments

Comments
 (0)