Skip to content

Next Release #2483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2024
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
46 changes: 29 additions & 17 deletions docusaurus/docs/reactnative/basics/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ For Expo, you can follow [this guide](https://docs.expo.dev/get-started/installa
In order to install the Stream Chat React Native SDK, run the following command in your terminal of choice:

<Tabs
defaultValue='rncli'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
]}
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
]}
>
<TabItem value='rncli'>

Expand All @@ -35,7 +36,7 @@ yarn add stream-chat-react-native
<TabItem value='expo'>

```bash title="Terminal"
yarn add stream-chat-expo
npx expo install stream-chat-expo
```

</TabItem>
Expand All @@ -46,6 +47,7 @@ Stream Chat React Native SDK requires installing some peer dependencies to provi

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand All @@ -62,7 +64,7 @@ yarn add @react-native-camera-roll/camera-roll @react-native-community/netinfo @
<TabItem value='expo'>

```bash title="Terminal"
expo install @stream-io/flat-list-mvcp @react-native-community/netinfo expo-file-system expo-image-manipulator expo-image-picker expo-media-library react-native-gesture-handler react-native-reanimated react-native-svg
npx expo install @stream-io/flat-list-mvcp @react-native-community/netinfo expo-file-system expo-image-manipulator expo-image-picker expo-media-library react-native-gesture-handler react-native-reanimated react-native-svg
```

</TabItem>
Expand All @@ -72,6 +74,7 @@ So what did we install precisely?

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand Down Expand Up @@ -111,6 +114,7 @@ There are a few optional dependencies that can be added to have more features wi

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand Down Expand Up @@ -148,28 +152,35 @@ The most important steps to get started are:

```js
module.exports = {
...
presets: [
... // don't add it here :)
],
plugins: [
...
// highlight-next-line
'react-native-reanimated/plugin', // Reanimated plugin has to be listed last.
'react-native-reanimated/plugin',
],
};
```

- Import `react-native-gesture-handler` at the top of your `index.js` file. It should look as follows:
:::caution
`react-native-reanimated/plugin` has to be listed last.
:::

```js
// highlight-next-line
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
- After installation, wrap your entry point with `<GestureHandlerRootView>` or `gestureHandlerRootHOC`:

import App from './App';
import { name as appName } from './app.json';
```js
import { GestureHandlerRootView } from 'react-native-gesture-handler';

AppRegistry.registerComponent(appName, () => App);
export default function App() {
return <GestureHandlerRootView style={{ flex: 1 }}>{/* content */}</GestureHandlerRootView>;
}
```

:::note
The entry point of your app exists usually either in `index.js` or `App.tsx` file. In case of navigation with Expo Router v3.x, the entry point is inside `app/_layout.js`.
:::

Please also follow the steps mentioned in the links below for corresponding dependencies:

- `react-native` - [additional installation steps](https://reactnative.dev/docs/image#gif-and-webp-support-on-android)
Expand All @@ -180,6 +191,7 @@ Now you should be able to run the app on simulator by running following command:

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand Down
2 changes: 2 additions & 0 deletions docusaurus/docs/reactnative/basics/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The SDK tries to keep the list of external dependencies to a minimum, these are

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand Down Expand Up @@ -93,6 +94,7 @@ There are a few optional dependencies that can be added by our users to have mor

<Tabs
defaultValue='rncli'
groupId='rn-platform'
values={[
{ label: 'RN CLI', value: 'rncli' },
{ label: 'Expo', value: 'expo' },
Expand Down
14 changes: 0 additions & 14 deletions docusaurus/docs/reactnative/customization/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,3 @@ Hooks, including those to access contexts, also require generics to be applied t
```tsx
const { channel } = useChannelContext<StreamChatGenerics>();
```

## Partial inference

Inference only works correctly when all generics are provided by a given input.
[Partial Type Argument Inference](https://github.com/microsoft/TypeScript/issues/26242) is currently not supported in TypeScript.

### Higher Order Components

The lack of partial inference is particularly relevant if Higher Order Components (HOC) are used in place of the provided context hooks.
The `withChannelContext` HOC accepts the generics similarly to the `useChannelContext` hook, but because partial inference is not supported the props for the wrapped component must also be explicitly provided.

```tsx {2}
withChannelContext<MyComponentProps, StreamChatGenerics>(MyComponent);
```
1 change: 1 addition & 0 deletions docusaurus/shared
55 changes: 30 additions & 25 deletions examples/ExpoMessaging/app/channel/[cid]/thread/[cid]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
import React, { useContext } from "react";
import { SafeAreaView, View } from "react-native";
import { Channel, Thread } from "stream-chat-expo";
import { Stack } from "expo-router";
import { AppContext } from "../../../../../context/AppContext";
import React, { useContext } from 'react';
import { SafeAreaView, View } from 'react-native';
import { Channel, Thread } from 'stream-chat-expo';
import { Stack } from 'expo-router';
import { AppContext } from '../../../../../context/AppContext';

export default function ThreadScreen() {
const { channel, thread, setThread } = useContext(AppContext);
return (
<SafeAreaView>
<Stack.Screen options={{ title: "Thread Screen" }} />
const { channel, thread, setThread } = useContext(AppContext);

<Channel channel={channel} thread={thread} threadList>
<View
style={{
flex: 1,
justifyContent: "flex-start",
}}
>
<Thread
onThreadDismount={() => {
setThread(undefined);
}}
/>
</View>
</Channel>
</SafeAreaView>
);
if (channel === undefined) {
return null;
}

return (
<SafeAreaView>
<Stack.Screen options={{ title: 'Thread Screen' }} />

<Channel channel={channel} thread={thread} threadList>
<View
style={{
flex: 1,
justifyContent: 'flex-start',
}}
>
<Thread
onThreadDismount={() => {
setThread(undefined);
}}
/>
</View>
</Channel>
</SafeAreaView>
);
}
4 changes: 2 additions & 2 deletions examples/ExpoMessaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@react-native-community/netinfo": "11.1.0",
"expo": "~50.0.13",
"expo": "~50.0.14",
"expo-av": "~13.10.5",
"expo-clipboard": "~5.0.1",
"expo-constants": "~15.4.5",
Expand All @@ -38,7 +38,7 @@
"react-native-web": "~0.19.6",
"stream-chat-expo": "link:../../package/expo-package",
"stream-chat-react-native-core": "link:../../package",
"typescript": "^5.1.3"
"typescript": "5.0.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
34 changes: 17 additions & 17 deletions examples/ExpoMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4153,10 +4153,10 @@ expo-modules-autolinking@1.10.3:
find-up "^5.0.0"
fs-extra "^9.1.0"

expo-modules-core@1.11.12:
version "1.11.12"
resolved "https://registry.yarnpkg.com/expo-modules-core/-/expo-modules-core-1.11.12.tgz#d5c7b3ed7ab57d4fb6885a0d8e10287dcf1ffe5f"
integrity sha512-/e8g4kis0pFLer7C0PLyx98AfmztIM6gU9jLkYnB1pU9JAfQf904XEi3bmszO7uoteBQwSL6FLp1m3TePKhDaA==
expo-modules-core@1.11.13:
version "1.11.13"
resolved "https://registry.yarnpkg.com/expo-modules-core/-/expo-modules-core-1.11.13.tgz#a8e63ad844e966dce78dea40b50839af6c3bc518"
integrity sha512-2H5qrGUvmLzmJNPDOnovH1Pfk5H/S/V0BifBmOQyDc9aUh9LaDwkqnChZGIXv8ZHDW8JRlUW0QqyWxTggkbw1A==
dependencies:
invariant "^2.2.4"

Expand Down Expand Up @@ -4192,10 +4192,10 @@ expo-status-bar@~1.11.1:
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.11.1.tgz#a11318741d361048c11db2b16c4364a79a74af30"
integrity sha512-ddQEtCOgYHTLlFUe/yH67dDBIoct5VIULthyT3LRJbEwdpzAgueKsX2FYK02ldh440V87PWKCamh7R9evk1rrg==

expo@~50.0.13:
version "50.0.14"
resolved "https://registry.yarnpkg.com/expo/-/expo-50.0.14.tgz#ddcae86aa0ba8d1be3da9ad1bdda23fa539dc97d"
integrity sha512-yLPdxCMVAbmeEIpzzyAuJ79wvr6ToDDtQmuLDMAgWtjqP8x3CGddXxUe07PpKEQgzwJabdHvCLP5Bv94wMFIjQ==
expo@~50.0.14:
version "50.0.15"
resolved "https://registry.yarnpkg.com/expo/-/expo-50.0.15.tgz#18c5c3ee0125fd42fe828b6791410eed68f7e74a"
integrity sha512-tsyRmMHjA8lPlM7AsqH1smSH8hzmn1+x/vsP+xgbKYJTGtYccdY/wsm6P84VJWeK5peWSVqrWNos+YuPqXKLSQ==
dependencies:
"@babel/runtime" "^7.20.0"
"@expo/cli" "0.17.8"
Expand All @@ -4209,7 +4209,7 @@ expo@~50.0.13:
expo-font "~11.10.3"
expo-keep-awake "~12.8.2"
expo-modules-autolinking "1.10.3"
expo-modules-core "1.11.12"
expo-modules-core "1.11.13"
fbemitter "^3.0.0"
whatwg-url-without-unicode "8.0.0-3"

Expand Down Expand Up @@ -7439,10 +7439,10 @@ stream-buffers@2.2.x:
version "0.0.0"
uid ""

stream-chat-react-native-core@5.26.0:
version "5.26.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.26.0.tgz#b081bde25585a9f571ac7bb2dc8c910e4ddc99c5"
integrity sha512-Sh5MufLMn6JlEDiML+xDwa5EaCkegHMhKTXdBxfbtbbxaBl1WDOhpwgR6ROIyvGt8nuJ4NQOzRseiNCyXpibXA==
stream-chat-react-native-core@5.27.0:
version "5.27.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.27.0.tgz#1cead940ca3a26555a97039e2e893e9698cff7b1"
integrity sha512-vIfq2pGMwDwYjnxgBfAOfVLo3nvVc+GBCFgJHtsEPm9o3HXZQNoxrTg5adFgKPQ7A6cC2MEs1uluWkmdRdFhpQ==
dependencies:
"@babel/runtime" "^7.12.5"
"@gorhom/bottom-sheet" "4.4.8"
Expand Down Expand Up @@ -7810,10 +7810,10 @@ type-fest@^0.7.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48"
integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==

typescript@^5.1.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff"
integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==
typescript@5.0.4:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==

ua-parser-js@^0.7.30:
version "0.7.35"
Expand Down
11 changes: 6 additions & 5 deletions examples/SampleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@types/react-native-video": "^5.0.18",
"@types/react-test-renderer": "18.0.0",
"babel-jest": "29.6.3",
"eslint": "^8.19.0",
"jest": "^29.7.0",
"@react-native/babel-preset": "0.73.21",
"@react-native/eslint-config": "0.73.2",
"@react-native/metro-config": "0.73.5",
"@react-native/typescript-config": "0.73.1",
"@rnx-kit/metro-config": "^1.3.14",
"@types/react": "^18.2.75",
"@types/react-native-video": "^5.0.18",
"@types/react-test-renderer": "18.0.0",
"babel-jest": "29.6.3",
"eslint": "^8.19.0",
"jest": "^29.7.0",
"prettier": "^2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
Expand Down
33 changes: 13 additions & 20 deletions examples/SampleApp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,14 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^18.2.75":
version "18.2.75"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.75.tgz#45d18f384939306d35312def1bf532eb38a68562"
integrity sha512-+DNnF7yc5y0bHkBTiLKqXFe+L4B3nvOphiMY3tuA5X10esmjqk7smyBZzbGTy2vsiy/Bnzj8yFIBL8xhRacoOg==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/scheduler@*":
version "0.16.8"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff"
Expand Down Expand Up @@ -6897,10 +6905,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@5.24.0:
version "5.24.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.24.0.tgz#425a06d2ad70efa322b8b4a6293de820fee9bb7d"
integrity sha512-HAGMjx69vfPLW8qOVKlcmQGTHDE3NBNi5H2mrf72J/mkSPtmFjMfC3/ZWY9RPwjdUyBMkUCv85ZN0n92sNHn6w==
stream-chat-react-native-core@5.27.0:
version "5.27.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.27.0.tgz#1cead940ca3a26555a97039e2e893e9698cff7b1"
integrity sha512-vIfq2pGMwDwYjnxgBfAOfVLo3nvVc+GBCFgJHtsEPm9o3HXZQNoxrTg5adFgKPQ7A6cC2MEs1uluWkmdRdFhpQ==
dependencies:
"@babel/runtime" "^7.12.5"
"@gorhom/bottom-sheet" "4.4.8"
Expand All @@ -6915,7 +6923,7 @@ stream-chat-react-native-core@5.24.0:
path "0.12.7"
react-native-markdown-package "1.8.2"
react-native-url-polyfill "^1.3.0"
stream-chat "8.15.0"
stream-chat "8.17.0"

"stream-chat-react-native-core@link:../../package":
version "0.0.0"
Expand All @@ -6925,21 +6933,6 @@ stream-chat-react-native-core@5.24.0:
version "0.0.0"
uid ""

stream-chat@8.15.0:
version "8.15.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.15.0.tgz#37d84768b24e32fcea85b29165e05cb2d5cae517"
integrity sha512-6qrV0pL5dBkqPslpoSkBLjrgiMtFaOvUChue7j3VafhogXGLpu4j6ACPWq3Lrj9XJGfJkOwfT7LyqEhwfmajgQ==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
base64-js "^1.5.1"
form-data "^4.0.0"
isomorphic-ws "^4.0.1"
jsonwebtoken "~9.0.0"
ws "^7.4.4"

stream-chat@8.17.0:
version "8.17.0"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.17.0.tgz#01c4aacbcdb5dd734b088e70f40cd42a0bcd0fb7"
Expand Down
2 changes: 1 addition & 1 deletion examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1507,4 +1507,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 90406e1e85c82b37484f5d746afa45c0637bb4b3

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
Loading
Loading