Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c0c1456
chore: markdown formatting while running lint command
khushal87 Oct 28, 2021
8a70173
chore: update the lint workflow for next release and release
khushal87 Nov 2, 2021
3e5cbeb
chore: resolve merge conflicts
khushal87 Nov 2, 2021
4821a8b
chore: change workflow settings for linting
khushal87 Nov 3, 2021
c11d813
fix: missing apostrophe in the workflow lint command
khushal87 Nov 3, 2021
5134a98
feat: Default to not renumbering lists
madsroskar Nov 9, 2021
4130d12
fix: Don't increment index for bullet too early
madsroskar Nov 9, 2021
c33bc59
style: Fix linting issues
madsroskar Nov 9, 2021
6bff633
refactor: Use JSX rather than React.createElement
madsroskar Nov 9, 2021
9b25d98
Merge pull request #983 from GetStream/mads/react-api-to-jsx
vishalnarkhede Nov 9, 2021
1ecbd4e
docs: Document the custom rule in a comment
madsroskar Nov 10, 2021
3cc0cf7
fix: Add list item number style
madsroskar Nov 11, 2021
8287980
Merge pull request #982 from GetStream/mads/md-list-numbering
madsroskar Nov 11, 2021
2f7a9d2
build: Remove e2e workflows as they're not stable enough atm
madsroskar Nov 11, 2021
828c4e3
Merge pull request #988 from GetStream/mads/remove-e2e-workflows
madsroskar Nov 11, 2021
af2729b
Merge pull request #972 from GetStream/develop
vishalnarkhede Nov 11, 2021
52ae8c3
chore(release): 3.10.0 [skip ci]
semantic-release-bot Nov 11, 2021
c527a30
build(deps): bump tmpl from 1.0.4 to 1.0.5 in /package
dependabot[bot] Nov 11, 2021
664bbe4
build(deps): bump tar from 6.1.8 to 6.1.11 in /package
dependabot[bot] Nov 11, 2021
a8dbfc9
build: improve next-release workflow
vishalnarkhede Nov 11, 2021
fab0993
fix: render attachment type video in FileAttachment view
vishalnarkhede Nov 15, 2021
1649ee3
Merge pull request #999 from GetStream/vishal/video-attachment-fix
vishalnarkhede Nov 15, 2021
7d09155
Merge pull request #1000 from GetStream/develop
vishalnarkhede Nov 15, 2021
bcfe102
chore(release): 3.10.1 [skip ci]
semantic-release-bot Nov 15, 2021
24a3f56
Merge pull request #989 from GetStream/dependabot/npm_and_yarn/packag…
madsroskar Nov 15, 2021
6ff8359
Merge pull request #990 from GetStream/dependabot/npm_and_yarn/packag…
madsroskar Nov 15, 2021
1da94cd
chore: resolved conflicts and updated markdown
khushal87 Nov 22, 2021
f9d81b7
refactor: change the markdown lint command
khushal87 Nov 22, 2021
67dbe4c
Merge branch 'v4.0.0' of github.com:GetStream/stream-chat-react-nativ…
vishalnarkhede Nov 22, 2021
e1dcaf1
Merge branch 'khushal87-markdown-prettier' of github.com:GetStream/st…
vishalnarkhede Nov 22, 2021
51989eb
Merge branch 'v4.0.0' of github.com:GetStream/stream-chat-react-nativ…
vishalnarkhede Nov 22, 2021
5888eb1
build: fixing lint-fix script
vishalnarkhede Nov 22, 2021
33d772c
build: fixed dir path for lint-fix command
vishalnarkhede Nov 22, 2021
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 .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
# for the sdk package
run: yarn --frozen-lockfile && yarn bootstrap-ci
- name: Lint
run: yarn lint
run: yarn lerna-workspaces run lint && cd docusaurus && npx prettier --check '**/*.mdx'
- name: Test
run: yarn test:unit
2 changes: 1 addition & 1 deletion .github/workflows/next-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Installation && Build SDK
run: yarn --frozen-lockfile && yarn bootstrap-ci
- name: Lint
run: yarn lerna-workspaces run lint
run: yarn lerna-workspaces run lint && (cd docusaurus; npx prettier --check '**/*.mdx')
- name: Publish Next Release
run: GITHUB_SHORT_SHA="$(git rev-parse --short $GITHUB_SHA)" yarn release-next
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Installation && Build SDK
run: yarn --frozen-lockfile && yarn bootstrap-ci
- name: Lint
run: yarn lerna-workspaces run lint
run: yarn lerna-workspaces run lint && cd docusaurus && npx prettier --check '**/*.mdx'
- name: Publish Release
run: yarn release
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Libraries

### [React Navigation Docs](https://reactnavigation.org/docs/getting-started/)

Our tutorials, guides and sample apps are all using React Navigation. We recommend using it in
Our tutorials, guides and sample apps are all using React Navigation. We recommend using it in
order to provide better support for all the use cases displayed.

### [Gesture Handler Docs](https://docs.swmansion.com/react-native-gesture-handler/docs/)
Expand All @@ -20,7 +20,7 @@ React Native Markdown Package is used to render markdown on our messages.

### [Reanimated Lib Docs](https://docs.swmansion.com/react-native-reanimated/docs)

React Native Reanimated is used to create our own beautiful custom animations in our gallery, attachment picker,
React Native Reanimated is used to create our own beautiful custom animations in our gallery, attachment picker,
message actions/reactions and loading indicators/skeletons.

### [Day.js Docs](https://day.js.org/docs/en/installation/installation)
Expand Down
6 changes: 3 additions & 3 deletions docusaurus/docs/reactnative/additional-resources/stream.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ In addition we have "cloned" some popular UIs to help demonstrate the flexibilit
### [JavaScript Client](https://getstream.io/chat/docs/javascript/?language=javascript)

Stream Chat for React Native uses the Stream Chat JS client under the hood for most interactions with the backend.
The client documentation covers a wide range of interactions that can be performed, not all of these are used within
The client documentation covers a wide range of interactions that can be performed, not all of these are used within
the Stream Chat for React Native SDK but can be integrated within your own app as required.

### [API Tutorial](https://getstream.io/chat/get_started/)

To help you get acquainted with the Stream Chat JS client we have an easy to follow tutorial on our website.
This is a great primer for using the client directly and can also help you understand how the Stream Chat for
React Native SDK if functioning under the hood.
This is a great primer for using the client directly and can also help you understand how the Stream Chat for
React Native SDK if functioning under the hood.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ still have decent typing support.

### [React Context](https://reactjs.org/docs/context.html)

We rely on multiple contexts in our SDK to access components, functions, and data.
Context also allows you as a developer to override our defaults for many of these throughout the SDK.
We rely on multiple contexts in our SDK to access components, functions, and data.
Context also allows you as a developer to override our defaults for many of these throughout the SDK.
Understanding how to draw upon values in context is important to customizing the SDK for your own needs.

### [React Hooks](https://reactjs.org/docs/hooks-intro.html)

We use/expose a bunch of our component's hooks so users can use them in order to replicate some behaviour/data
parsing when creating custom components. Understanding how to work with hooks can come in very handy.
We use/expose a bunch of our component's hooks so users can use them in order to replicate some behaviour/data
parsing when creating custom components. Understanding how to work with hooks can come in very handy.
87 changes: 45 additions & 42 deletions docusaurus/docs/reactnative/basics/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,34 @@ The Stream Chat client, `StreamChat` is a dependency of `stream-chat-react-nativ
To create a client instance you can call `getInstance` on the client and provide and api key.

```ts
import { StreamChat } from 'stream-chat';
import { StreamChat } from 'stream-chat';

const client = StreamChat.getInstance('api_key');
```

:::caution

**Usage of `StreamChat.getInstance()` available since stream-chat@2.12.0.**

<br />
This new Singleton pattern allows you to instantiate a unique StreamChat client, i.e create a StreamChat instance and retrieve
it wherever you need it on your app to perform API calls. After calling it once, any following <code>
getInstance
</code> call will return the initial StreamChat instance. This will prevent you from accidentally creating multiple StreamChat
instances, opening multiple WebSockets, and driving up your concurrent connections unnecessarily.
<br />
<br />
This new Singleton pattern allows you to instantiate a unique StreamChat client, i.e create a StreamChat instance and retrieve it wherever you need it on your app to perform API calls.
After calling it once, any following <code>getInstance</code> call will return the initial StreamChat instance.
This will prevent you from accidentally creating multiple StreamChat instances, opening multiple WebSockets, and driving up your concurrent connections unnecessarily.
<br /><br />

Stream Chat is backward compatible. Users can continue using <code>new StreamChat()</code> if desired.

<br />

```ts
const client = new StreamChat('api_key');
```

Calling <code>new StreamChat()</code> repeatedly will create new copies of the client and in turn new WebSocket connections when <code>connectUser</code> is called.
If you are using <code>new StreamChat()</code> you need to be vigilant about your use to ensure you are not creating multiple WebSocket connections unnecessarily.
If you are using <code>new StreamChat()</code> you need to be vigilant about your use to ensure you are not creating multiple WebSocket connections unnecessarily.

:::

Expand All @@ -53,13 +58,13 @@ To connect a user a the `connectUser` function should be called and provided wit
The `user_token` is typically sent from your back end when a user is authenticated.

```ts
await client.connectUser(
{
id: 'testUser',
name: 'Test User',
},
'user_token',
);
await client.connectUser(
{
id: 'testUser',
name: 'Test User',
},
'user_token',
);
```

It is recommended to not repeatedly call `connectUser` unnecessarily, multiple calls to `connectUser` will result in warnings, and attempting to call `connectUser` before disconnecting a current user will throw an Error.
Expand All @@ -70,18 +75,15 @@ The Stream Chat for React Native UI components handle most interactions with the

### Providing the Client to the UI

To provide the the client to the UI components you simply provide the client instance as the prop `client` to the `Chat` component.
To provide the the client to the UI components you simply provide the client instance as the prop `client` to the `Chat` component.

```tsx
import { StreamChat } from 'stream-chat';
import { StreamChat } from 'stream-chat';
import { Chat } from 'stream-chat-react-native';

const client = StreamChat.getInstance('api_key');

export const Screen = () =>
<Chat client={client}>
{/** App components */}
</Chat>
export const Screen = () => <Chat client={client}>{/** App components */}</Chat>;
```

The Stream Chat for React Native UI components then handle interacting with the client internally by accessing the client via [`context`](https://reactjs.org/docs/context.html).
Expand All @@ -90,6 +92,7 @@ The Stream Chat for React Native UI components then handle interacting with the

If you are customizing certain components or functionality you may have to interact with the client as well.
You can access the client provided to the `Chat` component internally via the `useChatContext`.

<br />

```ts
Expand Down Expand Up @@ -159,27 +162,27 @@ You can't add or remove members from channel created using a list of members.
>
<TabItem value='channelId'>

```ts
/**
* Channel created using a channel id
*/
const channel = client.channel(channel_type, 'channel_id', {
name: 'My New Channel',
});
```
```ts
/**
* Channel created using a channel id
*/
const channel = client.channel(channel_type, 'channel_id', {
name: 'My New Channel',
});
```

</TabItem>
<TabItem value='members'>

```ts
/**
* Channel created using a members list
*/
const channel = client.channel(channel_type, {
members: ['userOne', 'userTwo']
name: 'My New Channel',
});
```
```ts
/**
* Channel created using a members list
*/
const channel = client.channel(channel_type, {
members: ['userOne', 'userTwo']
name: 'My New Channel',
});
```

</TabItem>
</Tabs>
Expand All @@ -196,16 +199,16 @@ To create a channel on the server you must call `create` or `watch` on a new cha
>
<TabItem value='watch'>

```ts
await channel.watch();
```
```ts
await channel.watch();
```

</TabItem>
<TabItem value='create'>

```ts
await channel.create();
```
```ts
await channel.create();
```

</TabItem>
</Tabs>
Expand Down
37 changes: 19 additions & 18 deletions docusaurus/docs/reactnative/basics/getting_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ Install the required packages in your React Native project.
>
<TabItem value='yarn'>

```bash
yarn add stream-chat-react-native
```
```bash
yarn add stream-chat-react-native
```

</TabItem>
<TabItem value='npm'>

```bash
npm install stream-chat-react-native
```
```bash
npm install stream-chat-react-native
```

</TabItem>
</Tabs>
Expand Down Expand Up @@ -70,16 +70,16 @@ Most if not all of the required packages now support auto-linking so setup shoul
>
<TabItem value='yarn'>

```bash
yarn add @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
```
```bash
yarn add @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
```

</TabItem>
<TabItem value='npm'>

```bash
npm install @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
```
```bash
npm install @react-native-community/cameraroll @react-native-community/netinfo @stream-io/flat-list-mvcp react-native-document-picker react-native-fs react-native-gesture-handler react-native-haptic-feedback react-native-haptic-feedback react-native-image-crop-picker react-native-image-resizer react-native-reanimated react-native-safe-area-context react-native-share react-native-svg
```

</TabItem>
</Tabs>
Expand All @@ -91,10 +91,10 @@ For iOS on a Mac install the pods `npx pod-install ios`.
To be able to use the Stream Chat React Native SDK, a few dependencies must meet the following version requirements:

| react-native | stream-chat-react-native (min required) | react-native-reanimated (min required) |
| - | - | - |
| 0.65 | 3.9.0 | 2.2.1 |
| 0.64 | 3.6.2 | 2.2.0 |
| 0.63 | 3.0.0 | 2.2.0 |
| ------------ | --------------------------------------- | -------------------------------------- |
| 0.65 | 3.9.0 | 2.2.1 |
| 0.64 | 3.6.2 | 2.2.0 |
| 0.63 | 3.0.0 | 2.2.0 |

### Additional Steps

Expand All @@ -107,6 +107,7 @@ To be able to use the Stream Chat React Native SDK, a few dependencies must meet
:::info

`react-native-gesture-handler` requires the package to be imported at the **top of the entry file** before anything else, this is usually your `App.js` or `index.js` file.

<br />

```tsx
Expand All @@ -130,8 +131,8 @@ If you are planning to use file picker functionality, make sure you enable iClou
### AndroidX Support

> AndroidX is a major step forward in the Android ecosystem, and the old support library artifacts are being deprecated.
For 0.60, React Native has been migrated over to AndroidX.
This is a breaking change, and your native code and dependencies will need to be migrated as well.
> For 0.60, React Native has been migrated over to AndroidX.
> This is a breaking change, and your native code and dependencies will need to be migrated as well.

(Reference: <https://facebook.github.io/react-native/blog/2019/07/03/version-60#androidx-support>)

Expand Down
Loading