Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package/src/components/Attachment/VideoThumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@ 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';

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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
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';

import { CommandSearchSource, CommandSuggestion } from 'stream-chat';

import { AttachmentMediaPicker } from './AttachmentMediaPicker/AttachmentMediaPicker';

import {
AttachmentPickerGenericContent,
type AttachmentPickerContentProps,
} from './AttachmentPickerGenericContent';

import {
useAttachmentPickerContext,
useBottomSheetContext,
Expand All @@ -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<IconProps>;
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 width={22} height={22} stroke={semantics.textTertiary} />,
[Icon, semantics.textTertiary],
);

return (
<View
style={[
styles.container,
{
height,
},
container,
]}
>
<View style={[styles.infoContainer, infoContainer]}>
<ThemedIcon />
<Text style={[styles.text, text]}>{description}</Text>
</View>
<Button
variant={'secondary'}
type={'outline'}
size={'lg'}
label={buttonText}
onPress={onPress}
/>
</View>
);
};

const keyExtractor = (item: { id: string }) => item.id;

Expand Down Expand Up @@ -298,7 +222,7 @@ export const AttachmentFilePicker = (props: AttachmentPickerContentProps) => {
);
};

export type AttachmentPickerContentProps = Pick<AttachmentPickerGenericContentProps, 'height'>;
export type { AttachmentPickerContentProps } from './AttachmentPickerGenericContent';

export const AttachmentPickerContent = (props: AttachmentPickerContentProps) => {
const { height } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React, { useCallback, useMemo } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import { useTheme } from '../../../contexts/themeContext/ThemeContext';
import { IconProps } from '../../../icons';
import { primitives } from '../../../theme';
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 AttachmentPickerContentProps = {
height?: number;
};

export type AttachmentPickerGenericContentProps = AttachmentPickerContentProps & {
Icon: React.ComponentType<IconProps>;
onPress: () => void;
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 width={22} height={22} stroke={semantics.textTertiary} />,
[Icon, semantics.textTertiary],
);

return (
<View
style={[
styles.container,
{
height,
},
container,
]}
>
<View style={[styles.infoContainer, infoContainer]}>
<ThemedIcon />
<Text style={[styles.text, text]}>{description}</Text>
</View>
<Button
variant={'secondary'}
type={'outline'}
size={'lg'}
label={buttonText}
onPress={onPress}
/>
</View>
);
};
6 changes: 2 additions & 4 deletions package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,11 @@ import { emojis } from '../MessageMenu/emojis';
import { MessageActionList as MessageActionListDefault } from '../MessageMenu/MessageActionList';
import { MessageActionListItem as MessageActionListItemDefault } from '../MessageMenu/MessageActionListItem';
import { MessageMenu as MessageMenuDefault } from '../MessageMenu/MessageMenu';
import {
MessageReactionPicker as MessageReactionPickerDefault,
toUnicodeScalarString,
} from '../MessageMenu/MessageReactionPicker';
import { MessageReactionPicker as MessageReactionPickerDefault } from '../MessageMenu/MessageReactionPicker';
import { MessageUserReactions as MessageUserReactionsDefault } from '../MessageMenu/MessageUserReactions';
import { MessageUserReactionsAvatar as MessageUserReactionsAvatarDefault } from '../MessageMenu/MessageUserReactionsAvatar';
import { MessageUserReactionsItem as MessageUserReactionsItemDefault } from '../MessageMenu/MessageUserReactionsItem';
import { toUnicodeScalarString } from '../MessageMenu/utils/toUnicodeScalarString';
import { Reply as ReplyDefault } from '../Reply/Reply';

export type MarkReadFunctionOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import React, { useMemo, useRef, useState } from 'react';
import { ActivityIndicator, StyleSheet, Text, View, ViewStyle } from 'react-native';
import Animated, {
Extrapolation,
interpolate,
SharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';

import {
ImageGalleryProviderProps,
useImageGalleryContext,
} from '../../../contexts/imageGalleryContext/ImageGalleryContext';
import type { ImageGalleryFooterProps, ImageGalleryVideoControlProps } from './types';

import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
import { useStateStore } from '../../../hooks/useStateStore';
Expand Down Expand Up @@ -38,24 +32,10 @@ export type ImageGalleryFooterCustomComponent = ({
shareMenuOpen: boolean;
}) => React.ReactElement | null;

export type ImageGalleryVideoControlProps = {
attachmentId: string;
};

export type ImageGalleryVideoControlComponent = ({
attachmentId,
}: ImageGalleryVideoControlProps) => React.ReactElement | null;

export type ImageGalleryFooterProps = Pick<
ImageGalleryProviderProps,
'ImageGalleryVideoControls'
> & {
accessibilityLabel: string;
opacity: SharedValue<number>;
openGridView: () => void;
visible: SharedValue<number>;
};

const imageGallerySelector = (state: ImageGalleryState) => ({
asset: state.assets[state.currentIndex],
currentIndex: state.currentIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import React, { useEffect, useMemo, useState } from 'react';

import { StyleSheet, Text, View, ViewStyle } from 'react-native';

import Animated, {
Extrapolation,
interpolate,
SharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';

import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContext';
import type { ImageGalleryHeaderProps } from './types';

import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
import { useOverlayContext } from '../../../contexts/overlayContext/OverlayContext';
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
Expand All @@ -26,11 +23,6 @@ const ReanimatedSafeAreaView = Animated.createAnimatedComponent
? Animated.createAnimatedComponent(SafeAreaView)
: SafeAreaView;

export type ImageGalleryHeaderProps = {
opacity: SharedValue<number>;
visible: SharedValue<number>;
};

const imageGallerySelector = (state: ImageGalleryState) => ({
asset: state.assets[state.currentIndex],
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useMemo } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import { ImageGalleryVideoControlProps } from './ImageGalleryFooter';
import type { ImageGalleryVideoControlProps } from './types';

import { useTheme } from '../../../contexts/themeContext/ThemeContext';

Expand Down
Loading
Loading