diff --git a/examples/SampleApp/src/components/AddMembersBottomSheet.tsx b/examples/SampleApp/src/components/AddMembersBottomSheet.tsx
index 3160b87d95..2a17faa594 100644
--- a/examples/SampleApp/src/components/AddMembersBottomSheet.tsx
+++ b/examples/SampleApp/src/components/AddMembersBottomSheet.tsx
@@ -12,13 +12,13 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import {
BottomSheetModal,
Checkmark,
- Close,
StreamBottomSheetModalFlatList,
UserAvatar,
useStableCallback,
useTheme,
} from 'stream-chat-react-native';
+import { Close } from '../icons/Close';
import { CircleClose } from '../icons/CircleClose';
import { usePaginatedUsers } from '../hooks/usePaginatedUsers';
@@ -159,7 +159,7 @@ export const AddMembersBottomSheet = React.memo(
const initialLoadComplete = initialResults !== null;
- const emptyComponent = useMemo(() => {
+ const EmptyComponent = useCallback(() => {
if (loading && !initialLoadComplete) {
return (
@@ -248,7 +248,7 @@ export const AddMembersBottomSheet = React.memo(
keyExtractor={keyExtractor}
keyboardDismissMode='interactive'
keyboardShouldPersistTaps='handled'
- ListEmptyComponent={emptyComponent}
+ ListEmptyComponent={EmptyComponent}
onEndReached={loadMore}
renderItem={renderItem}
contentContainerStyle={styles.listContent}
diff --git a/examples/SampleApp/src/components/AllMembersBottomSheet.tsx b/examples/SampleApp/src/components/AllMembersBottomSheet.tsx
index a482ad6f59..ea504a1046 100644
--- a/examples/SampleApp/src/components/AllMembersBottomSheet.tsx
+++ b/examples/SampleApp/src/components/AllMembersBottomSheet.tsx
@@ -3,7 +3,6 @@ import { Pressable, StyleSheet, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import {
BottomSheetModal,
- Close,
StreamBottomSheetModalFlatList,
UserAdd,
useStableCallback,
@@ -12,6 +11,7 @@ import {
import { ContactDetailBottomSheet } from './ContactDetailBottomSheet';
import { MemberListItem } from './MemberListItem';
+import { Close } from '../icons/Close';
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
import type { Channel, ChannelMemberResponse } from 'stream-chat';
diff --git a/examples/SampleApp/src/components/BottomTabs.tsx b/examples/SampleApp/src/components/BottomTabs.tsx
index 7676c42353..684a1ea694 100644
--- a/examples/SampleApp/src/components/BottomTabs.tsx
+++ b/examples/SampleApp/src/components/BottomTabs.tsx
@@ -13,6 +13,7 @@ import type { BottomTabBarProps } from '@react-navigation/bottom-tabs';
import type { Route } from '@react-navigation/native';
import { DraftsTab } from '../icons/DraftsTab';
import { RemindersTab } from '../icons/ReminderTab';
+import { useLegacyColors } from '../theme/useLegacyColors';
const styles = StyleSheet.create({
notification: {
@@ -84,11 +85,8 @@ type TabProps = Pick & {
const Tab = (props: TabProps) => {
const { navigation, state, route, index } = props;
- const {
- theme: {
- colors: { black, grey },
- },
- } = useTheme();
+ useTheme();
+ const { black, grey } = useLegacyColors();
const tab = getTab(route.name);
const isFocused = state.index === index;
@@ -130,11 +128,8 @@ const Tab = (props: TabProps) => {
export const BottomTabs: React.FC = (props) => {
const { navigation, state } = props;
- const {
- theme: {
- colors: { white },
- },
- } = useTheme();
+ useTheme();
+ const { white } = useLegacyColors();
const { bottom } = useSafeAreaInsets();
return (
diff --git a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
index 705a9b8c77..6d920f1998 100644
--- a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
+++ b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
@@ -7,7 +7,6 @@ import Animated from 'react-native-reanimated';
import {
CircleClose,
Delete,
- User,
UserMinus,
useTheme,
useViewport,
@@ -24,6 +23,8 @@ import { Archive } from '../icons/Archive';
import { useChannelInfoOverlayActions } from '../hooks/useChannelInfoOverlayActions';
import { SafeAreaView } from 'react-native-safe-area-context';
import { Pin } from '../icons/Pin.tsx';
+import { User } from '../icons/User';
+import { useLegacyColors } from '../theme/useLegacyColors';
import type { ConfirmationData } from './ConfirmationBottomSheet';
@@ -102,11 +103,9 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
const { channel, clientId, membership, navigation } = data || {};
const {
- theme: {
- colors: { accent_red, black, grey },
- semantics,
- },
+ theme: { semantics },
} = useTheme();
+ const { accent_red, black, grey } = useLegacyColors();
// magic number 8 used as fontSize is 16 so assuming average character width of half
const maxWidth = channel
diff --git a/examples/SampleApp/src/components/ChatScreenHeader.tsx b/examples/SampleApp/src/components/ChatScreenHeader.tsx
index 902de89b62..aa0be96dff 100644
--- a/examples/SampleApp/src/components/ChatScreenHeader.tsx
+++ b/examples/SampleApp/src/components/ChatScreenHeader.tsx
@@ -1,13 +1,14 @@
import React from 'react';
import { Image, StyleSheet, TouchableOpacity } from 'react-native';
import { CompositeNavigationProp, useNavigation } from '@react-navigation/native';
-import { useChatContext, useTheme } from 'stream-chat-react-native';
+import { useChatContext } from 'stream-chat-react-native';
import { RoundButton } from './RoundButton';
import { ScreenHeader } from './ScreenHeader';
import { useAppContext } from '../context/AppContext';
import { NewDirectMessageIcon } from '../icons/NewDirectMessageIcon';
+import { useLegacyColors } from '../theme/useLegacyColors';
import type { DrawerNavigationProp } from '@react-navigation/drawer';
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
@@ -29,11 +30,7 @@ type ChatScreenHeaderNavigationProp = CompositeNavigationProp<
>;
export const ChatScreenHeader: React.FC<{ title?: string }> = ({ title = 'Stream Chat' }) => {
- const {
- theme: {
- colors: { accent_blue },
- },
- } = useTheme();
+ const { accent_blue } = useLegacyColors();
const navigation = useNavigation();
const { chatClient } = useAppContext();
diff --git a/examples/SampleApp/src/components/ContactDetailBottomSheet.tsx b/examples/SampleApp/src/components/ContactDetailBottomSheet.tsx
index 9dc7b95ab0..dbc56be219 100644
--- a/examples/SampleApp/src/components/ContactDetailBottomSheet.tsx
+++ b/examples/SampleApp/src/components/ContactDetailBottomSheet.tsx
@@ -4,7 +4,6 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import {
BottomSheetModal,
CircleBan,
- MessageIcon,
useChatContext,
useStableCallback,
useTheme,
@@ -13,6 +12,7 @@ import {
import { ListItem } from './ListItem';
+import { Message } from '../icons/Message';
import { Mute } from '../icons/Mute';
import { getUserActivityStatus } from '../utils/getUserActivityStatus';
@@ -120,7 +120,7 @@ export const ContactDetailBottomSheet = React.memo(
}
+ icon={}
label='Send Direct Message'
onPress={sendDirectMessage}
/>
diff --git a/examples/SampleApp/src/components/DraftsList.tsx b/examples/SampleApp/src/components/DraftsList.tsx
index 4a7cc43013..78eaff35f2 100644
--- a/examples/SampleApp/src/components/DraftsList.tsx
+++ b/examples/SampleApp/src/components/DraftsList.tsx
@@ -11,6 +11,7 @@ import { useCallback, useEffect, useMemo } from 'react';
import dayjs from 'dayjs';
import { useIsFocused, useNavigation } from '@react-navigation/native';
import { ChannelResponse, DraftMessage, DraftResponse, MessageResponseBase } from 'stream-chat';
+import { useLegacyColors } from '../theme/useLegacyColors';
export type DraftItemProps = {
type?: 'channel' | 'thread';
@@ -22,11 +23,8 @@ export type DraftItemProps = {
};
export const DraftItem = ({ type, channel, date, message, thread }: DraftItemProps) => {
- const {
- theme: {
- colors: { grey },
- },
- } = useTheme();
+ useTheme();
+ const { grey } = useLegacyColors();
const navigation = useNavigation();
const { client } = useChatContext();
const messagePreviewText = useMessagePreviewText({ message });
diff --git a/examples/SampleApp/src/components/EditGroupBottomSheet.tsx b/examples/SampleApp/src/components/EditGroupBottomSheet.tsx
index 2f1d1988e8..4feb8400f5 100644
--- a/examples/SampleApp/src/components/EditGroupBottomSheet.tsx
+++ b/examples/SampleApp/src/components/EditGroupBottomSheet.tsx
@@ -13,11 +13,11 @@ import {
BottomSheetModal,
ChannelAvatar,
Checkmark,
- Close,
useStableCallback,
useTheme,
} from 'stream-chat-react-native';
+import { Close } from '../icons/Close';
import type { Channel } from 'stream-chat';
type EditGroupBottomSheetProps = {
diff --git a/examples/SampleApp/src/components/LocationSharing/CreateLocationModal.tsx b/examples/SampleApp/src/components/LocationSharing/CreateLocationModal.tsx
index c675b4cc4e..427f5c7cd2 100644
--- a/examples/SampleApp/src/components/LocationSharing/CreateLocationModal.tsx
+++ b/examples/SampleApp/src/components/LocationSharing/CreateLocationModal.tsx
@@ -25,6 +25,7 @@ import {
useTranslationContext,
} from 'stream-chat-react-native';
import MapView, { MapMarker, Marker } from 'react-native-maps';
+import { useLegacyColors } from '../../theme/useLegacyColors';
type LiveLocationCreateModalProps = {
visible: boolean;
@@ -47,11 +48,8 @@ export const LiveLocationCreateModal = ({
const messageComposer = useMessageComposer();
const { width, height } = useWindowDimensions();
const { client } = useChatContext();
- const {
- theme: {
- colors: { accent_blue, grey, grey_whisper },
- },
- } = useTheme();
+ useTheme();
+ const { accent_blue, grey, grey_whisper } = useLegacyColors();
const { t } = useTranslationContext();
const mapRef = useRef(null);
const markerRef = useRef(null);
diff --git a/examples/SampleApp/src/components/LocationSharing/MessageLocation.tsx b/examples/SampleApp/src/components/LocationSharing/MessageLocation.tsx
index 82c9d7511e..e64f42894f 100644
--- a/examples/SampleApp/src/components/LocationSharing/MessageLocation.tsx
+++ b/examples/SampleApp/src/components/LocationSharing/MessageLocation.tsx
@@ -16,6 +16,7 @@ import {
} from 'stream-chat-react-native';
import MapView, { MapMarker, Marker } from 'react-native-maps';
import { SharedLocationResponse, StreamChat } from 'stream-chat';
+import { useLegacyColors } from '../../theme/useLegacyColors';
const MessageLocationFooter = ({
client,
@@ -26,11 +27,8 @@ const MessageLocationFooter = ({
}) => {
const { channel } = useChannelContext();
const { end_at, user_id } = shared_location;
- const {
- theme: {
- colors: { grey },
- },
- } = useTheme();
+ useTheme();
+ const { grey } = useLegacyColors();
const liveLocationActive = end_at && new Date(end_at) > new Date();
const endedAtDate = end_at ? new Date(end_at) : null;
const formattedEndedAt = endedAtDate ? endedAtDate.toLocaleString() : '';
@@ -79,12 +77,8 @@ const MessageLocationComponent = ({
const { width, height } = useWindowDimensions();
const aspect_ratio = width / height;
-
- const {
- theme: {
- colors: { accent_blue },
- },
- } = useTheme();
+ useTheme();
+ const { accent_blue } = useLegacyColors();
const region = useMemo(() => {
const latitudeDelta = 0.1;
diff --git a/examples/SampleApp/src/components/MenuDrawer.tsx b/examples/SampleApp/src/components/MenuDrawer.tsx
index dba552fd1a..a8cf01effb 100644
--- a/examples/SampleApp/src/components/MenuDrawer.tsx
+++ b/examples/SampleApp/src/components/MenuDrawer.tsx
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Image, StyleSheet, Text, TouchableOpacity, Pressable, View } from 'react-native';
-import { Edit, User, useTheme } from 'stream-chat-react-native';
+import { Edit, useTheme } from 'stream-chat-react-native';
import { useAppContext } from '../context/AppContext';
import { SecretMenu } from './SecretMenu.tsx';
@@ -8,6 +8,8 @@ import { SecretMenu } from './SecretMenu.tsx';
import type { DrawerContentComponentProps } from '@react-navigation/drawer';
import { SafeAreaView } from 'react-native-safe-area-context';
import { Group } from '../icons/Group.tsx';
+import { User } from '../icons/User';
+import { useLegacyColors } from '../theme/useLegacyColors';
export const styles = StyleSheet.create({
avatar: {
@@ -49,12 +51,8 @@ export const styles = StyleSheet.create({
export const MenuDrawer = ({ navigation }: DrawerContentComponentProps) => {
const [secretMenuPressCounter, setSecretMenuPressCounter] = useState(0);
const [secretMenuVisible, setSecretMenuVisible] = useState(false);
-
- const {
- theme: {
- colors: { black, grey, white },
- },
- } = useTheme();
+ useTheme();
+ const { black, grey, white } = useLegacyColors();
useEffect(() => {
if (!secretMenuVisible && secretMenuPressCounter >= 7) {
diff --git a/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx b/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
index ad2ec54ded..55a305a2a4 100644
--- a/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
+++ b/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
@@ -5,6 +5,7 @@ import dayjs from 'dayjs';
import calendar from 'dayjs/plugin/calendar';
import { Spinner, useTheme, useViewport, UserAvatar } from 'stream-chat-react-native';
import { DEFAULT_PAGINATION_LIMIT } from '../../utils/constants';
+import { useLegacyColors } from '../../theme/useLegacyColors';
import type { MessageResponse } from 'stream-chat';
@@ -72,10 +73,10 @@ export const MessageSearchList: React.FC = React.forward
} = props;
const {
theme: {
- colors: { black, grey, white_snow },
semantics,
},
} = useTheme();
+ const { black, grey, white_snow } = useLegacyColors();
const { vw } = useViewport();
const navigation =
useNavigation>();
diff --git a/examples/SampleApp/src/components/NetworkDownIndicator.tsx b/examples/SampleApp/src/components/NetworkDownIndicator.tsx
index 453b7e9972..3c46e49c06 100644
--- a/examples/SampleApp/src/components/NetworkDownIndicator.tsx
+++ b/examples/SampleApp/src/components/NetworkDownIndicator.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Spinner, useTheme } from 'stream-chat-react-native';
+import { useLegacyColors } from '../theme/useLegacyColors';
const styles = StyleSheet.create({
networkDownContainer: {
@@ -23,11 +24,8 @@ const styles = StyleSheet.create({
export const NetworkDownIndicator: React.FC<{ titleSize: 'small' | 'large' }> = ({
titleSize = 'small',
}) => {
- const {
- theme: {
- colors: { black },
- },
- } = useTheme();
+ useTheme();
+ const { black } = useLegacyColors();
return (
diff --git a/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx b/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
index 41b28767c9..8c89ab8f03 100644
--- a/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
+++ b/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
@@ -17,6 +17,7 @@ import { NewDirectMessagingScreenNavigationProp } from '../screens/NewDirectMess
import { useUserSearchContext } from '../context/UserSearchContext';
import { useAppContext } from '../context/AppContext';
import { SendUp } from '../icons/SendUp';
+import { useLegacyColors } from '../theme/useLegacyColors';
type NewDirectMessagingSendButtonPropsWithContext = Pick<
MessageInputContextValue,
@@ -29,10 +30,10 @@ const SendButtonWithContext = (props: NewDirectMessagingSendButtonPropsWithConte
const { disabled = false, giphyActive, sendMessage } = props;
const {
theme: {
- colors: { accent_blue, grey_gainsboro },
messageComposer: { sendButton },
},
} = useTheme();
+ const { accent_blue, grey_gainsboro } = useLegacyColors();
return (
;
@@ -8,10 +9,7 @@ type OverlayBackdropProps = {
export const OverlayBackdrop = (props: OverlayBackdropProps): React.ReactNode => {
const { style = {} } = props;
- const {
- theme: {
- colors: { overlay },
- },
- } = useTheme();
+ useTheme();
+ const { overlay } = useLegacyColors();
return ;
};
diff --git a/examples/SampleApp/src/components/Reminders/ReminderBanner.tsx b/examples/SampleApp/src/components/Reminders/ReminderBanner.tsx
index e180d8da26..d649f8e904 100644
--- a/examples/SampleApp/src/components/Reminders/ReminderBanner.tsx
+++ b/examples/SampleApp/src/components/Reminders/ReminderBanner.tsx
@@ -6,17 +6,15 @@ import {
useTranslationContext,
useStateStore,
} from 'stream-chat-react-native';
+import { useLegacyColors } from '../../theme/useLegacyColors';
const reminderStateSelector = (state: ReminderState) => ({
timeLeftMs: state.timeLeftMs,
});
export const ReminderBanner = (item: ReminderResponse) => {
- const {
- theme: {
- colors: { accent_blue, accent_red },
- },
- } = useTheme();
+ useTheme();
+ const { accent_blue, accent_red } = useLegacyColors();
const { t } = useTranslationContext();
const { message_id } = item;
const reminder = useMessageReminder(message_id);
diff --git a/examples/SampleApp/src/components/Reminders/ReminderItem.tsx b/examples/SampleApp/src/components/Reminders/ReminderItem.tsx
index 06d47ff551..ff48704d41 100644
--- a/examples/SampleApp/src/components/Reminders/ReminderItem.tsx
+++ b/examples/SampleApp/src/components/Reminders/ReminderItem.tsx
@@ -12,6 +12,7 @@ import {
} from 'stream-chat-react-native';
import { ReminderBanner } from './ReminderBanner';
import Swipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
+import { useLegacyColors } from '../../theme/useLegacyColors';
export const ReminderItem = (
item: ReminderResponse & { onDeleteHandler?: (id: string) => void },
@@ -23,10 +24,10 @@ export const ReminderItem = (
const channelName = channel?.name ? channel.name : 'Channel';
const {
theme: {
- colors: { accent_red, white_smoke, grey_gainsboro },
semantics,
},
} = useTheme();
+ const { accent_red, white_smoke, grey_gainsboro } = useLegacyColors();
const messagePreviewText = useMessagePreviewText({ message });
const MessagePreviewIcon = useMessagePreviewIcon({ message });
diff --git a/examples/SampleApp/src/components/Reminders/RemindersList.tsx b/examples/SampleApp/src/components/Reminders/RemindersList.tsx
index 348de0c3eb..ce1fc4255e 100644
--- a/examples/SampleApp/src/components/Reminders/RemindersList.tsx
+++ b/examples/SampleApp/src/components/Reminders/RemindersList.tsx
@@ -11,6 +11,7 @@ import {
import { useChatContext, useTheme, useQueryReminders } from 'stream-chat-react-native';
import { ReminderResponse } from 'stream-chat';
import { ReminderItem } from './ReminderItem';
+import { useLegacyColors } from '../../theme/useLegacyColors';
const tabs = [
{ key: 'all', title: 'All' },
@@ -29,11 +30,8 @@ const renderItem = ({ item }: { item: ReminderResponse }) => {
const [selectedTab, setSelectedTab] = useState(tabs[0]);
- const {
- theme: {
- colors: { accent_blue, grey_gainsboro },
- },
- } = useTheme();
+ useTheme();
+ const { accent_blue, grey_gainsboro } = useLegacyColors();
const { client } = useChatContext();
const { data, isLoading, loadNext } = useQueryReminders();
diff --git a/examples/SampleApp/src/components/RoundButton.tsx b/examples/SampleApp/src/components/RoundButton.tsx
index 1e2c474a10..3cc44e09fc 100644
--- a/examples/SampleApp/src/components/RoundButton.tsx
+++ b/examples/SampleApp/src/components/RoundButton.tsx
@@ -1,6 +1,7 @@
import React, { PropsWithChildren } from 'react';
import { Platform, StyleSheet, TouchableOpacity } from 'react-native';
-import { useTheme } from 'stream-chat-react-native';
+
+import { useLegacyColors } from '../theme/useLegacyColors';
const styles = StyleSheet.create({
container: {
@@ -32,11 +33,7 @@ type RoundButtonProps = PropsWithChildren<{
export const RoundButton: React.FC = (props) => {
const { children, disabled, onPress } = props;
- const {
- theme: {
- colors: { black, icon_background },
- },
- } = useTheme();
+ const { black, icon_background } = useLegacyColors();
return (
= (props) => {
} = props;
const {
- theme: {
- colors: { black, grey, white },
- semantics,
- },
+ theme: { semantics },
} = useTheme();
+ const { black, grey, white } = useLegacyColors();
const insets = useSafeAreaInsets();
return (
diff --git a/examples/SampleApp/src/components/SecretMenu.tsx b/examples/SampleApp/src/components/SecretMenu.tsx
index cfec27f07b..1658394754 100644
--- a/examples/SampleApp/src/components/SecretMenu.tsx
+++ b/examples/SampleApp/src/components/SecretMenu.tsx
@@ -14,13 +14,15 @@ import {
StyleSheet,
ScrollView,
} from 'react-native';
-import { Close, Edit, Delete, ZIP, useTheme } from 'stream-chat-react-native';
+import { Edit, Delete, ZIP, useTheme } from 'stream-chat-react-native';
import { styles as menuDrawerStyles } from './MenuDrawer.tsx';
import AsyncStore from '../utils/AsyncStore.ts';
import { StreamChat } from 'stream-chat';
import { LabeledTextInput } from '../screens/AdvancedUserSelectorScreen.tsx';
+import { Close } from '../icons/Close.tsx';
import { Notification } from '../icons/Notification.tsx';
import { Folder } from '../icons/Folder.tsx';
+import { useLegacyColors } from '../theme/useLegacyColors.ts';
const isAndroid = Platform.OS === 'android';
@@ -274,11 +276,8 @@ export const SecretMenu = ({
const [selectedMessageOverlayBackdrop, setSelectedMessageOverlayBackdrop] = useState<
MessageOverlayBackdropConfigItem['value'] | null
>(null);
- const {
- theme: {
- colors: { black, grey },
- },
- } = useTheme();
+ useTheme();
+ const { black, grey } = useLegacyColors();
const notificationConfigItems = useMemo(
() => [
diff --git a/examples/SampleApp/src/components/ToastComponent/Toast.tsx b/examples/SampleApp/src/components/ToastComponent/Toast.tsx
index 80fe1527c7..8bd79e6af7 100644
--- a/examples/SampleApp/src/components/ToastComponent/Toast.tsx
+++ b/examples/SampleApp/src/components/ToastComponent/Toast.tsx
@@ -3,6 +3,7 @@ import Animated, { Easing, SlideInDown, SlideOutDown } from 'react-native-reanim
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
import { useInAppNotificationsState, useTheme } from 'stream-chat-react-native';
import type { Notification, NotificationState } from 'stream-chat';
+import { useLegacyColors } from '../../theme/useLegacyColors';
const { width } = Dimensions.get('window');
@@ -17,11 +18,8 @@ export const Toast = () => {
const { closeInAppNotification, notifications } = useInAppNotificationsState();
const { top } = useSafeAreaInsets();
- const {
- theme: {
- colors: { overlay, white_smoke },
- },
- } = useTheme();
+ useTheme();
+ const { overlay, white_smoke } = useLegacyColors();
// When offline, we upload pending attachments by cleaning up the previous upload, this results in a cancelled/aborted error from the server, so we filter out those notifications.
const filteredNotifications = notifications.filter(
diff --git a/examples/SampleApp/src/components/UserInfoOverlay.tsx b/examples/SampleApp/src/components/UserInfoOverlay.tsx
index 8ac7ef9444..70074bbeab 100644
--- a/examples/SampleApp/src/components/UserInfoOverlay.tsx
+++ b/examples/SampleApp/src/components/UserInfoOverlay.tsx
@@ -15,9 +15,7 @@ import Animated, {
withTiming,
} from 'react-native-reanimated';
import {
- MessageIcon,
useChatContext,
- User,
useTheme,
useViewport,
UserAvatar,
@@ -33,6 +31,9 @@ import { useUserInfoOverlayActions } from '../hooks/useUserInfoOverlayActions';
import { SafeAreaView } from 'react-native-safe-area-context';
import { UserMinus } from '../icons/UserMinus';
import { CircleClose } from '../icons/CircleClose';
+import { Message } from '../icons/Message';
+import { User } from '../icons/User';
+import { useLegacyColors } from '../theme/useLegacyColors';
import type { ConfirmationData } from './ConfirmationBottomSheet';
@@ -107,11 +108,9 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
const { channel, member } = data || {};
const {
- theme: {
- colors: { accent_red, black, grey, white },
- semantics,
- },
+ theme: { semantics },
} = useTheme();
+ const { accent_red, black, grey, white } = useLegacyColors();
const offsetY = useSharedValue(0);
const translateY = useSharedValue(0);
@@ -313,7 +312,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
]}
>
-
+
Message
diff --git a/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx b/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
index 4ea60b956e..b6a62de741 100644
--- a/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
+++ b/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
@@ -1,9 +1,9 @@
import React from 'react';
import { Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
-import { useTheme } from 'stream-chat-react-native';
import type { UserResponse } from 'stream-chat';
+import { useLegacyColors } from '../../theme/useLegacyColors';
const styles = StyleSheet.create({
tagContainer: {
@@ -38,11 +38,7 @@ export const SelectedUserTag: React.FC = ({
onPress,
tag,
}) => {
- const {
- theme: {
- colors: { black, grey_gainsboro },
- },
- } = useTheme();
+ const { black, grey_gainsboro } = useLegacyColors();
return (
= ({
removeButton = true,
user,
}) => {
- const {
- theme: {
- colors: { black, white_snow },
- },
- } = useTheme();
+ useTheme();
+ const { black, white_snow } = useLegacyColors();
return (
diff --git a/examples/SampleApp/src/components/UserSearch/UserSearchResults.tsx b/examples/SampleApp/src/components/UserSearch/UserSearchResults.tsx
index 65dcdb0e6e..ba609f1cc4 100644
--- a/examples/SampleApp/src/components/UserSearch/UserSearchResults.tsx
+++ b/examples/SampleApp/src/components/UserSearch/UserSearchResults.tsx
@@ -9,15 +9,17 @@ import {
} from 'react-native';
import dayjs from 'dayjs';
import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
-import { Close, useTheme, useViewport, UserAvatar } from 'stream-chat-react-native';
+import { useTheme, useViewport, UserAvatar } from 'stream-chat-react-native';
import { useUserSearchContext } from '../../context/UserSearchContext';
import type { UserResponse } from 'stream-chat';
+import { Close } from '../../icons/Close';
import { Search } from '../../icons/Search';
import calendar from 'dayjs/plugin/calendar';
import { CheckSend } from '../../icons/CheckSend';
+import { useLegacyColors } from '../../theme/useLegacyColors';
dayjs.extend(calendar);
@@ -92,20 +94,18 @@ export const UserSearchResults: React.FC = ({
}>
>([]);
const {
- theme: {
- colors: {
- accent_blue,
- bg_gradient_end,
- bg_gradient_start,
- black,
- grey,
- grey_gainsboro,
- white_smoke,
- white_snow,
- },
- semantics,
- },
+ theme: { semantics },
} = useTheme();
+ const {
+ accent_blue,
+ bg_gradient_end,
+ bg_gradient_start,
+ black,
+ grey,
+ grey_gainsboro,
+ white_smoke,
+ white_snow,
+ } = useLegacyColors();
const { vw } = useViewport();
const results = resultsProp || resultsContext;
diff --git a/examples/SampleApp/src/icons/AddUser.tsx b/examples/SampleApp/src/icons/AddUser.tsx
index 13995fdefd..7b741bf105 100644
--- a/examples/SampleApp/src/icons/AddUser.tsx
+++ b/examples/SampleApp/src/icons/AddUser.tsx
@@ -1,15 +1,11 @@
import React from 'react';
import Svg, { Path } from 'react-native-svg';
-import { useTheme } from 'stream-chat-react-native';
import { IconProps } from '../utils/base';
+import { useLegacyColors } from '../theme/useLegacyColors';
export const AddUser: React.FC = ({ fill, height, width }) => {
- const {
- theme: {
- colors: { grey },
- },
- } = useTheme();
+ const { grey } = useLegacyColors();
return (