Skip to content

Commit ae5e640

Browse files
committed
Merge branch 'develop'
2 parents 5ca5b58 + 8aae34d commit ae5e640

File tree

207 files changed

+5239
-4421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+5239
-4421
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ aliases:
1818
- sample/node_modules
1919
- packages/uikit-chat-hooks/node_modules
2020
- packages/uikit-react-native/node_modules
21-
- packages/uikit-react-native-core/node_modules
2221
- packages/uikit-react-native-foundation/node_modules
2322
- packages/uikit-utils/node_modules
2423
- &create_app_env

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ version.ts
2121

2222
*.app.dSYM.zip
2323
lerna-debug.log
24+
25+
/docs

OPENSOURCE_GUIDELINES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Sendbird UIKit Open Source Guidelines
2+
3+
Sendbird is excited to share UIKit to the open source community in order to speed up the go-to-market strategy for our customers. We’ve already seen how UIKit enables you to go to market with ease, but now we want to provide you with the flexibility to fine tune UIKit for your own market needs.
4+
5+
This community guideline outlines Sendbird’s stance on open source and explains how you can take advantage of UIKit’s open source.
6+
7+
* We recommend you to use UIKit open source only if the standard UIKit SDK does not suit your use case. This includes if you’d like to use a Sendbird Chat SDK feature that is currently unavailable in UIKit.
8+
* We will provide limited support should you choose to use our open source code and fork it (clone and edit the code in your own repository) because we won’t be able to transparently understand the code.
9+
* We don’t accept direct contributions to the source code. If you discover a bug or would like to suggest improvements to the source code, you can share them in the [Sendbird Community UIKit forum](https://community.sendbird.com/c/sendbird-chat-uikit/)).
10+
11+
_UIKit is licensed under the MIT open source license_

README.md

Lines changed: 148 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,163 @@
11
# sendbird-uikit-react-native
22

3-
uikit
3+
[![Platform React-Native](https://img.shields.io/badge/Platform-React--Native-orange.svg)](https://reactnative.dev/)
4+
[![Language TypeScript](https://img.shields.io/badge/Language-TypeScript-orange.svg)](https://www.typescriptlang.org/)
45

5-
[![Status_Build](https://github.com/sendbird/sendbird-uikit-react-native/actions/workflows/status-build.yml/badge.svg)](https://github.com/sendbird/sendbird-uikit-react-native/actions/workflows/status-build.yml)
6-
[![Status_Test](https://github.com/sendbird/sendbird-uikit-react-native/actions/workflows/status-test.yml/badge.svg)](https://github.com/sendbird/sendbird-uikit-react-native/actions/workflows/status-test.yml)
6+
> React-Native based UI kit based on sendbird javascript SDK
77
8-
---
8+
## Introduction
9+
10+
Sendbird UIKit for React-Native is a development kit with an user interface that enables an easy and fast integration of standard chat features into new or existing client apps.
11+
This mono-repository the UIKit source code is consists as explained below.
12+
13+
- [**packages/uikit-react-native**](/packages/uikit-react-native) is where you can find the open source code. Check out [UIKit Open Source Guidelines](/OPENSOURCE_GUIDELINES.md) for more information regarding our stance on open source.
14+
- [**sample**](/sample) is a chat app with UIKit’s core features in which you can see items such as push notifications, total unread message count and auto sign-in are demonstrated. When you sign in to the sample app, you will only see a list of channels rendered by the [GroupChannelListFragment](https://sendbird.com/docs/uikit/v3/react-native/key-functions/list-channels) on the screen.
15+
- [**packages/uikit-react-native-foundation**](/packages/uikit-react-native-foundation) is a UI package for `uikit-react-native`.
16+
- [**packages/uikit-chat-hooks**](/packages/uikit-chat-hooks) is a react hooks package for `uikit-react-native`.
17+
- [**packages/uikit-utils**](/packages/uikit-utils) is a utility package for `uikit-react-native`.
18+
19+
### More about Sendbird UIKit for React-Native
20+
21+
Find out more about Sendbird UIKit for React-Native at [UIKit for React Native doc](https://sendbird.com/docs/uikit/v3/react-native/overview).
22+
If you need any help in resolving any issues or have questions, visit [our community](https://community.sendbird.com).
23+
24+
<br/>
25+
26+
## Requirements
27+
28+
- Nodejs 14 or newer
29+
- [yarn v1](https://classic.yarnpkg.com/en/docs/install)
30+
- Watchman
31+
- JDK 11 or newer
32+
- XCode
33+
- Android Studio
34+
35+
More details, please see https://reactnative.dev/docs/environment-setup
36+
37+
<br/>
38+
39+
## Try the sample app
40+
41+
We are using sample app for development, you can check the sample app [here](/sample) and also check the UI components via storybook in the sample app.
42+
43+
### Installation
44+
45+
> Every script should be run on the root of the project.
46+
47+
**Install node modules**
48+
49+
```shell
50+
yarn install
51+
```
52+
53+
**Linking native modules of sample app**
54+
55+
```shell
56+
yarn sample:pod-install
57+
```
58+
59+
**Running sample app**
60+
61+
- Android
62+
63+
```shell
64+
yarn sample:android
65+
```
66+
67+
- iOS
68+
69+
```shell
70+
yarn sample:ios
71+
```
72+
73+
### Sample app using your data
74+
75+
Create a file to `sample/src/env.ts` and write the code below to the file you created.
76+
77+
```ts
78+
export const APP_ID = '2D7B4CDB-932F-4082-9B09-A1153792DC8D';
79+
```
80+
81+
If you would like to try the sample app specifically fit to your usage, you can do so by replacing the default sample app ID with yours, which you can obtain by creating your [Sendbird application from the dashboard](https://dashboard.sendbird.com/).
82+
83+
<br />
84+
85+
## Development
86+
87+
We tried development on macOS / Linux systems. You might encounter problems in running sample or scripts like `yarn build` in Windows machines.
88+
89+
### Creating a new key function files
90+
91+
Run the script and enter the key function name as a lower camel case like `groupChannel`, and then you can see the auto generated files in the `/packages/uikit-react-native/src/domain`
92+
93+
```shell
94+
yarn workspace @sendbird/uikit-react-native run create-domain
95+
```
96+
97+
### Managing repository
98+
99+
> **Note**
100+
> We are using [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces) and [lerna](https://github.com/lerna/lerna) to maintain this monorepo
101+
102+
#### Package dependencies
103+
104+
See [yarn workspace](https://classic.yarnpkg.com/en/docs/cli/workspace)
105+
106+
```shell
107+
# Add dependency to specific workspace package
108+
yarn workspace @sendbird/package add package-name
109+
# Remove dependency from specific workspace package
110+
yarn workspace @sendbird/package remove package-name
111+
112+
# Add dependency to root
113+
yarn workspace -W add package-name
114+
```
115+
116+
> **Warning** You should better install to root if you're trying to install native view modules.
117+
> Sometimes native view module in the workspace is not hoisted, and it leads to `Tried to register two views` error on the sample app.
118+
119+
#### Bump version
120+
121+
See [lerna version](https://github.com/lerna/lerna/tree/main/commands/version)
122+
123+
```shell
124+
lerna version {major|minor|patch} [--no-git-tag-version] [--no-private]
125+
126+
# or
127+
128+
yarn bump:{major|minor|patch}
129+
```
130+
131+
#### Publish
132+
133+
See [lerna publish](https://github.com/lerna/lerna/tree/main/commands/publish)
134+
135+
<br/>
9136

10137
## Scripts
11138

12-
### Lint & Prettier
139+
### Build
13140

14-
- check: `yarn lint`
15-
- fix: `yarn fix`
141+
```shell
142+
yarn build
143+
```
16144

17145
### Test
18146

19-
- test: `yarn test`
147+
```shell
148+
# Unit test
149+
yarn test
20150

21-
### Package dependencies
151+
# Build test
152+
yarn test:build
153+
```
22154

23-
- add: `yarn workspace @sendbird/package add some-package`
24-
- remove: `yarn workspace @sendbird/package remove some-package`
155+
### Lint and Prettier
25156

26-
### Publish
27-
> Bump > Build > Deploy
157+
```shell
158+
# Check formatting
159+
yarn lint
28160

29-
- bump script: `lerna version {major|minor|patch} [--no-git-tag-version] [--no-private]` or `yarn bump:{major|minor|patch}`
30-
- build script: `yarn build`
161+
# Fix formatting
162+
yarn fix
163+
```

lerna.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@
88
"version": "0.1.2",
99
"command": {
1010
"publish": {
11-
"allowBranch": "main",
1211
"conventionalCommits": true,
1312
"createRelease": "github",
1413
"message": "chore(release): publish %v"
1514
},
1615
"version": {
17-
"allowBranch": [
18-
"main",
19-
"*/lerna"
20-
],
2116
"conventionalCommits": true,
2217
"exact": true,
2318
"gitRemote": "origin",

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"reset": "find . -type dir -name node_modules | xargs rm -rf",
2323
"clean": "lerna run clean",
2424
"build": "lerna run build",
25+
"docs": "yarn build && typedoc --out docs --entryPointStrategy packages 'packages/*' && yarn clean",
2526
"test": "jest --verbose",
2627
"test:build": "yarn build --stream && yarn clean --stream",
2728
"lint": "yarn lint:eslint && yarn lint:prettier",
@@ -30,6 +31,7 @@
3031
"lint:prettier": "prettier --check \"sample/src/**/*.{ts,tsx}\" \"packages/*/src/**/*.{ts,tsx}\"",
3132
"fix:eslint": "eslint --fix packages/*/src --ext ts,tsx -c ./.eslintrc.js",
3233
"fix:prettier": "prettier --write \"sample/src/**/*.{ts,tsx}\" \"packages/*/src/**/*.{ts,tsx}\"",
34+
"sample:pod-install": "cd sample/ios && pod install",
3335
"sample:ios": "cd sample && yarn ios",
3436
"sample:android": "cd sample && yarn android",
3537
"deploy:ios": "cd sample/ios && bundle exec fastlane deploy",
@@ -57,8 +59,10 @@
5759
"react": "17.0.2",
5860
"react-native": "0.66.4",
5961
"react-native-builder-bob": "^0.18.2",
62+
"react-native-fast-image": "^8.5.11",
6063
"react-native-safe-area-context": "^3.3.2",
6164
"react-test-renderer": "^17.0.2",
65+
"typedoc": "^0.23.7",
6266
"typescript": "^4.5.4"
6367
},
6468
"resolutions": {

packages/uikit-chat-hooks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# @sendbird/uikit-chat-hooks
22

3-
uikit-chat-hooks
3+
React custom hooks with Sendbird Chat SDK v3, made for UIKit
44

55
## Installation
66

77
```sh
8-
npm install @sendbird/uikit-chat-hooks
8+
npm i @sendbird/uikit-chat-hooks
99
```

packages/uikit-chat-hooks/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"peerDependencies": {
4949
"react": ">=16.13.1",
50-
"sendbird": "^3.1.16"
50+
"sendbird": "^3.1.22"
5151
},
5252
"react-native-builder-bob": {
5353
"source": "src",
@@ -62,5 +62,10 @@
6262
}
6363
]
6464
]
65+
},
66+
"typedoc": {
67+
"entryPoint": "./src/index.ts",
68+
"readmeFile": "./README.md",
69+
"displayName": "@sendbird/uikit-chat-hooks"
6570
}
6671
}

packages/uikit-chat-hooks/src/channel/useActiveGroupChannel.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { useEffect, useState } from 'react';
2-
import type Sendbird from 'sendbird';
32

4-
import type { SendbirdChatSDK } from '@sendbird/uikit-utils';
3+
import type { SendbirdChatSDK, SendbirdGroupChannel } from '@sendbird/uikit-utils';
54

6-
export const useActiveGroupChannel = (sdk: SendbirdChatSDK, staleChannel: Sendbird.GroupChannel) => {
5+
export const useActiveGroupChannel = (sdk: SendbirdChatSDK, staleChannel: SendbirdGroupChannel) => {
76
const [activeChannel, setActiveChannel] = useState(() => staleChannel);
87

98
useEffect(() => {

packages/uikit-chat-hooks/src/channel/useGroupChannelList.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import type { SendbirdChatSDK } from '@sendbird/uikit-utils';
2-
3-
import type { UseGroupChannelList, UseGroupChannelListOptions } from '../types';
1+
import type { UseGroupChannelList } from '../types';
42
import { useGroupChannelListWithCollection } from './useGroupChannelListWithCollection';
53
import { useGroupChannelListWithQuery } from './useGroupChannelListWithQuery';
64

7-
export const useGroupChannelList = (
8-
sdk: SendbirdChatSDK,
9-
userId?: string,
10-
options?: UseGroupChannelListOptions,
11-
): UseGroupChannelList => {
5+
export const useGroupChannelList: UseGroupChannelList = (sdk, userId, options) => {
126
if (sdk.isCacheEnabled || options?.enableCollectionWithoutLocalCache) {
137
return useGroupChannelListWithCollection(sdk, userId, options);
148
} else {

0 commit comments

Comments
 (0)