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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
[![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
[![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-467%20KB-blue)
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-469%20KB-blue)

<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/[email protected]?auto=format,enhance" width="50%" />

Expand Down
7 changes: 7 additions & 0 deletions examples/ExpoMessaging/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
{
"microphonePermission": "$(PRODUCT_NAME) would like to use your microphone for voice recording."
}
],
[
"expo-video",
{
"supportsBackgroundPlayback": true,
"supportsPictureInPicture": true
}
]
]
}
Expand Down
3 changes: 1 addition & 2 deletions examples/ExpoMessaging/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { ChannelList } from 'stream-chat-expo';
import { useContext, useMemo } from 'react';
import { Stack, useRouter } from 'expo-router';
import { ChannelSort } from 'stream-chat';
import { StreamChatGenerics } from '../types';
import { AppContext } from '../context/AppContext';
import { user } from '../constants';

const filters = {
members: { $in: [user.id] },
type: 'messaging',
};
const sort: ChannelSort<StreamChatGenerics> = { last_updated: -1 };
const sort: ChannelSort = { last_updated: -1 };
const options = {
state: true,
watch: true,
Expand Down
5 changes: 2 additions & 3 deletions examples/ExpoMessaging/components/ChatWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren } from 'react';
import React, { PropsWithChildren, useRef } from 'react';
import {
Chat,
OverlayProvider,
Expand All @@ -7,7 +7,6 @@ import {
useCreateChatClient,
} from 'stream-chat-expo';
import { AuthProgressLoader } from './AuthProgressLoader';
import { StreamChatGenerics } from '../types';
import { STREAM_API_KEY, user, userToken } from '../constants';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useStreamChatTheme } from '../useStreamChatTheme';
Expand All @@ -34,7 +33,7 @@ export const ChatWrapper = ({ children }: PropsWithChildren<{}>) => {
}

return (
<OverlayProvider<StreamChatGenerics>
<OverlayProvider
bottomInset={bottom}
i18nInstance={streami18n}
value={{ style: theme }}
Expand Down
15 changes: 7 additions & 8 deletions examples/ExpoMessaging/context/AppContext.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { PropsWithChildren, createContext, useContext, useState } from 'react';
import { StreamChatGenerics } from '../types';
import { PropsWithChildren, createContext, useState } from 'react';
import { Channel as ChannelType } from 'stream-chat';
import { ThreadContextValue } from 'stream-chat-expo';

export type AppContextType = {
channel: ChannelType<StreamChatGenerics> | undefined;
setChannel: React.Dispatch<React.SetStateAction<ChannelType<StreamChatGenerics> | undefined>>;
channel: ChannelType | undefined;
setChannel: React.Dispatch<React.SetStateAction<ChannelType | undefined>>;
setThread: React.Dispatch<
React.SetStateAction<ThreadContextValue<StreamChatGenerics>['thread'] | undefined>
React.SetStateAction<ThreadContextValue['thread'] | undefined>
>;
thread: ThreadContextValue<StreamChatGenerics>['thread'] | undefined;
thread: ThreadContextValue['thread'] | undefined;
};

export const AppContext = createContext<AppContextType>({
Expand All @@ -20,9 +19,9 @@ export const AppContext = createContext<AppContextType>({
});

export const AppProvider = ({ children }: PropsWithChildren) => {
const [channel, setChannel] = useState<ChannelType<StreamChatGenerics> | undefined>(undefined);
const [channel, setChannel] = useState<ChannelType | undefined>(undefined);
const [thread, setThread] = useState<
ThreadContextValue<StreamChatGenerics>['thread'] | undefined
ThreadContextValue['thread'] | undefined
>(undefined);

return (
Expand Down
41 changes: 41 additions & 0 deletions examples/ExpoMessaging/custom-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
DefaultAttachmentData,
DefaultChannelData,
DefaultCommandData,
DefaultEventData,
DefaultMemberData,
DefaultMessageData,
DefaultPollData,
DefaultPollOptionData,
DefaultReactionData,
DefaultThreadData,
DefaultUserData,
} from 'stream-chat-expo';

declare module 'stream-chat' {
/* eslint-disable @typescript-eslint/no-empty-object-type */

interface CustomAttachmentData extends DefaultAttachmentData {}

interface CustomChannelData extends DefaultChannelData {}

interface CustomCommandData extends DefaultCommandData {}

interface CustomEventData extends DefaultEventData {}

interface CustomMemberData extends DefaultMemberData {}

interface CustomUserData extends DefaultUserData {}

interface CustomMessageData extends DefaultMessageData {}

interface CustomPollOptionData extends DefaultPollOptionData {}

interface CustomPollData extends DefaultPollData {}

interface CustomReactionData extends DefaultReactionData {}

interface CustomThreadData extends DefaultThreadData {}

/* eslint-enable @typescript-eslint/no-empty-object-type */
}
5 changes: 4 additions & 1 deletion examples/ExpoMessaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"expo-image-manipulator": "~13.0.6",
"expo-image-picker": "~16.0.6",
"expo-linking": "~7.0.5",
"expo-media-library": "~17.0.6",
"expo-router": "~4.0.17",
"expo-sharing": "~13.0.1",
"expo-splash-screen": "~0.29.22",
"expo-status-bar": "~2.0.1",
"expo-video": "^2.0.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.77.1",
Expand All @@ -46,5 +46,8 @@
"@rnx-kit/metro-config": "^2.0.1",
"@rnx-kit/metro-resolver-symlinks": "^0.2.1"
},
"resolutions": {
"@types/react": "^19.0.0"
},
"private": true
}
23 changes: 0 additions & 23 deletions examples/ExpoMessaging/types.ts

This file was deleted.

Loading
Loading