Skip to content

Commit f16e476

Browse files
committed
fix: try out picker in channel
1 parent c353a32 commit f16e476

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ import { ImageLoadingFailedIndicator as ImageLoadingFailedIndicatorDefault } fro
126126
import { ImageLoadingIndicator as ImageLoadingIndicatorDefault } from '../Attachment/ImageLoadingIndicator';
127127
import { ImageReloadIndicator as ImageReloadIndicatorDefault } from '../Attachment/ImageReloadIndicator';
128128
import { VideoThumbnail as VideoThumbnailDefault } from '../Attachment/VideoThumbnail';
129+
import { AttachmentPicker, AttachmentPickerProps } from '../AttachmentPicker/AttachmentPicker';
129130
import { AttachmentPickerBottomSheetHandle as DefaultAttachmentPickerBottomSheetHandle } from '../AttachmentPicker/components/AttachmentPickerBottomSheetHandle';
131+
import { AttachmentPickerError as DefaultAttachmentPickerError } from '../AttachmentPicker/components/AttachmentPickerError';
132+
import { AttachmentPickerErrorImage as DefaultAttachmentPickerErrorImage } from '../AttachmentPicker/components/AttachmentPickerErrorImage';
133+
import { AttachmentPickerIOSSelectMorePhotos as DefaultAttachmentPickerIOSSelectMorePhotos } from '../AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos';
130134
import { AttachmentPickerSelectionBar as DefaultAttachmentPickerSelectionBar } from '../AttachmentPicker/components/AttachmentPickerSelectionBar';
135+
import { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent } from '../AttachmentPicker/components/ImageOverlaySelectedComponent';
131136
import { AutoCompleteSuggestionHeader as AutoCompleteSuggestionHeaderDefault } from '../AutoCompleteInput/AutoCompleteSuggestionHeader';
132137
import { AutoCompleteSuggestionItem as AutoCompleteSuggestionItemDefault } from '../AutoCompleteInput/AutoCompleteSuggestionItem';
133138
import { AutoCompleteSuggestionList as AutoCompleteSuggestionListDefault } from '../AutoCompleteInput/AutoCompleteSuggestionList';
@@ -257,6 +262,19 @@ const debounceOptions = {
257262

258263
export type ChannelPropsWithContext = Pick<ChannelContextValue, 'channel'> &
259264
Partial<Pick<AttachmentPickerContextValue, 'bottomInset' | 'topInset'>> &
265+
Partial<
266+
Pick<
267+
AttachmentPickerProps,
268+
| 'AttachmentPickerError'
269+
| 'AttachmentPickerErrorImage'
270+
| 'AttachmentPickerIOSSelectMorePhotos'
271+
| 'ImageOverlaySelectedComponent'
272+
| 'attachmentPickerErrorButtonText'
273+
| 'attachmentPickerErrorText'
274+
| 'numberOfAttachmentImagesToLoadPerCall'
275+
| 'numberOfAttachmentPickerImageColumns'
276+
>
277+
> &
260278
Partial<
261279
Pick<
262280
ChannelContextValue,
@@ -508,6 +526,14 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
508526
AutoCompleteSuggestionHeader = AutoCompleteSuggestionHeaderDefault,
509527
AutoCompleteSuggestionItem = AutoCompleteSuggestionItemDefault,
510528
AutoCompleteSuggestionList = AutoCompleteSuggestionListDefault,
529+
AttachmentPickerError = DefaultAttachmentPickerError,
530+
AttachmentPickerErrorImage = DefaultAttachmentPickerErrorImage,
531+
AttachmentPickerIOSSelectMorePhotos = DefaultAttachmentPickerIOSSelectMorePhotos,
532+
ImageOverlaySelectedComponent = DefaultImageOverlaySelectedComponent,
533+
attachmentPickerErrorButtonText,
534+
attachmentPickerErrorText,
535+
numberOfAttachmentImagesToLoadPerCall = 60,
536+
numberOfAttachmentPickerImageColumns = 3,
511537

512538
autoCompleteSuggestionsLimit,
513539
bottomInset = 0,
@@ -677,7 +703,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
677703
thread: threadFromProps,
678704
threadList,
679705
threadMessages,
680-
topInset = 0,
706+
topInset,
681707
TypingIndicator = TypingIndicatorDefault,
682708
TypingIndicatorContainer = TypingIndicatorContainerDefault,
683709
UnreadMessagesNotification = UnreadMessagesNotificationDefault,
@@ -1654,6 +1680,37 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
16541680
}
16551681
});
16561682

1683+
const attachmentPickerProps = useMemo(
1684+
() => ({
1685+
AttachmentPickerBottomSheetHandle,
1686+
attachmentPickerBottomSheetHandleHeight,
1687+
attachmentPickerBottomSheetHeight,
1688+
AttachmentPickerError,
1689+
attachmentPickerErrorButtonText,
1690+
AttachmentPickerErrorImage,
1691+
attachmentPickerErrorText,
1692+
AttachmentPickerIOSSelectMorePhotos,
1693+
attachmentSelectionBarHeight,
1694+
ImageOverlaySelectedComponent,
1695+
numberOfAttachmentImagesToLoadPerCall,
1696+
numberOfAttachmentPickerImageColumns,
1697+
}),
1698+
[
1699+
AttachmentPickerBottomSheetHandle,
1700+
attachmentPickerBottomSheetHandleHeight,
1701+
attachmentPickerBottomSheetHeight,
1702+
AttachmentPickerError,
1703+
attachmentPickerErrorButtonText,
1704+
AttachmentPickerErrorImage,
1705+
attachmentPickerErrorText,
1706+
AttachmentPickerIOSSelectMorePhotos,
1707+
attachmentSelectionBarHeight,
1708+
ImageOverlaySelectedComponent,
1709+
numberOfAttachmentImagesToLoadPerCall,
1710+
numberOfAttachmentPickerImageColumns,
1711+
],
1712+
);
1713+
16571714
const attachmentPickerContext = useMemo(
16581715
() => ({
16591716
bottomInset,
@@ -1962,6 +2019,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
19622019
<AttachmentPickerProvider value={attachmentPickerContext}>
19632020
<MessageInputProvider value={inputMessageInputContext}>
19642021
<View style={{ height: '100%' }}>{children}</View>
2022+
<AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />
19652023
</MessageInputProvider>
19662024
</AttachmentPickerProvider>
19672025
</ThreadProvider>

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
686686
<AttachmentPickerSelectionBar />
687687
</View>
688688
) : null}
689-
<AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />
689+
{/* <AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} /> */}
690690
</>
691691
) : null}
692692

0 commit comments

Comments
 (0)