diff --git a/package/src/components/Attachment/VideoThumbnail.tsx b/package/src/components/Attachment/VideoThumbnail.tsx index 43210eea6f..f255c32531 100644 --- a/package/src/components/Attachment/VideoThumbnail.tsx +++ b/package/src/components/Attachment/VideoThumbnail.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { ImageBackground, ImageStyle, StyleProp, StyleSheet, ViewStyle } from 'react-native'; import { useTheme } from '../../contexts/themeContext/ThemeContext'; -import { VideoPlayIndicator } from '../ui'; +import { VideoPlayIndicator } from '../ui/VideoPlayIndicator'; const styles = StyleSheet.create({ container: { diff --git a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx index 95d7491f07..86e7fac67c 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Linking, StyleSheet } from 'react-native'; import { renderAttachmentPickerItem } from './AttachmentPickerItem'; +import { IOS_LIMITED_DEEPLINK, type PhotoContentItemType } from './shared'; import { useAttachmentPickerContext, useTheme, useTranslationContext } from '../../../../contexts'; @@ -9,21 +10,11 @@ import { useStableCallback } from '../../../../hooks'; import { Picture } from '../../../../icons'; import { NativeHandlers } from '../../../../native'; -import type { File } from '../../../../types/types'; import { BottomSheetFlatList } from '../../../BottomSheetCompatibility/BottomSheetFlatList'; import { - AttachmentPickerContentProps, AttachmentPickerGenericContent, -} from '../AttachmentPickerContent'; - -export const IOS_LIMITED_DEEPLINK = '@getstream/ios-limited-button' as const; - -export type IosLimitedItemType = { uri: typeof IOS_LIMITED_DEEPLINK }; - -export type PhotoContentItemType = File | IosLimitedItemType; - -export const isIosLimited = (item: PhotoContentItemType): item is IosLimitedItemType => - 'uri' in item && item.uri === '@getstream/ios-limited-button'; + type AttachmentPickerContentProps, +} from '../AttachmentPickerGenericContent'; const keyExtractor = (item: PhotoContentItemType) => item.uri; diff --git a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx index 63e8e0700e..e546d40409 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx @@ -4,7 +4,7 @@ import { Alert, ImageBackground, StyleSheet, Text, View } from 'react-native'; import { FileReference, isLocalImageAttachment, isLocalVideoAttachment } from 'stream-chat'; -import { isIosLimited, PhotoContentItemType } from './AttachmentMediaPicker'; +import { isIosLimited, type PhotoContentItemType } from './shared'; import { useAttachmentPickerContext } from '../../../../contexts'; import { useAttachmentManagerState } from '../../../../contexts/messageInputContext/hooks/useAttachmentManagerState'; diff --git a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/shared.ts b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/shared.ts new file mode 100644 index 0000000000..4f2cf9ebaa --- /dev/null +++ b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/shared.ts @@ -0,0 +1,10 @@ +import type { File } from '../../../../types/types'; + +export const IOS_LIMITED_DEEPLINK = '@getstream/ios-limited-button' as const; + +export type IosLimitedItemType = { uri: typeof IOS_LIMITED_DEEPLINK }; + +export type PhotoContentItemType = File | IosLimitedItemType; + +export const isIosLimited = (item: PhotoContentItemType): item is IosLimitedItemType => + 'uri' in item && item.uri === IOS_LIMITED_DEEPLINK; diff --git a/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx b/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx index 6a26aeffe8..35233862f2 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { Linking, Platform, Pressable, StyleSheet, Text, View } from 'react-native'; +import { Linking, Platform, Pressable, StyleSheet, Text } from 'react-native'; import { FlatList } from 'react-native-gesture-handler'; @@ -7,6 +7,11 @@ import { CommandSearchSource, CommandSuggestion } from 'stream-chat'; import { AttachmentMediaPicker } from './AttachmentMediaPicker/AttachmentMediaPicker'; +import { + AttachmentPickerGenericContent, + type AttachmentPickerContentProps, +} from './AttachmentPickerGenericContent'; + import { useAttachmentPickerContext, useBottomSheetContext, @@ -16,90 +21,9 @@ import { } from '../../../contexts'; import { useTheme } from '../../../contexts/themeContext/ThemeContext'; import { useAttachmentPickerState, useStableCallback } from '../../../hooks'; -import { Camera, FilePickerIcon, IconProps, PollThumbnail, Recorder } from '../../../icons'; +import { Camera, FilePickerIcon, PollThumbnail, Recorder } from '../../../icons'; import { primitives } from '../../../theme'; import { CommandSuggestionItem } from '../../AutoCompleteInput/AutoCompleteSuggestionItem'; -import { Button } from '../../ui'; - -const useStyles = () => { - const { - theme: { semantics }, - } = useTheme(); - - return useMemo( - () => - StyleSheet.create({ - container: { - alignItems: 'center', - justifyContent: 'center', - backgroundColor: semantics.backgroundCoreElevation1, - paddingHorizontal: primitives.spacing2xl, - paddingBottom: primitives.spacing3xl, - }, - infoContainer: { flex: 1, alignItems: 'center', justifyContent: 'center' }, - text: { - fontSize: primitives.typographyFontSizeMd, - color: semantics.textSecondary, - marginTop: 8, - marginHorizontal: 24, - textAlign: 'center', - maxWidth: 200, - }, - }), - [semantics.backgroundCoreElevation1, semantics.textSecondary], - ); -}; - -export type AttachmentPickerGenericContentProps = { - Icon: React.ComponentType; - onPress: () => void; - height?: number; - buttonText?: string; - description?: string; -}; - -export const AttachmentPickerGenericContent = (props: AttachmentPickerGenericContentProps) => { - const { height, buttonText, Icon, description, onPress } = props; - const styles = useStyles(); - - const { - theme: { - semantics, - attachmentPicker: { - content: { container, text, infoContainer }, - }, - }, - } = useTheme(); - - const ThemedIcon = useCallback( - () => , - [Icon, semantics.textTertiary], - ); - - return ( - - - - {description} - -