-
Notifications
You must be signed in to change notification settings - Fork 43
[EDU-1993] - Add Chat's React Native getting started guide #2687
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
base: main
Are you sure you want to change the base?
[EDU-1993] - Add Chat's React Native getting started guide #2687
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
761fe29
to
bbc1684
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments, but looks good!
bbc1684
to
4b44f1e
Compare
80cd3d8
to
4d476ba
Compare
12a03ee
to
28f321e
Compare
Thanks @splindsay-92 I've updated the PR based on your feedback. If you could give it another look over, that would be greatly appreciated. |
28f321e
to
dbc3fdb
Compare
Thank you @splindsay-92 I've updated from your feedback to have the new functionality of the Chat SDK. Please let me know what you think (It's in the fixup) |
Display the online status of clients using the presence feature. This enables clients to be aware of one another if they are present in the same room. You can then show clients who else is online, provide a custom status update for each, and notify the room when someone enters it, or leaves it, such as by going offline. | ||
|
||
The Chat SDK exposes both the [`usePresence()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresence.html) and [`usePresenceListener()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresenceListener.html) hooks to interact with the presence feature. The `usePresence()` hook allows you to enter the room and update your presence status, while the `usePresenceListener()` hook allows you to subscribe to presence updates for the room. | ||
The [`usePresenceListener()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.usePresenceListener.html) hook also returns an object with the `presenceData` array, which contains the current presence data for the room. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, it looks a bit strange in the browser that usePresenceListener
is linked externally twice, where usePresence
is not. I'd be happy to say link all occurrences, or just link the first two :)
// ChatApp.tsx | ||
function ReactionComponent() { | ||
const reactions = ['👍', '❤️', '💥', '🚀', '👎', '💔']; | ||
const [roomReactions, setRoomReactions] = useState<Reaction[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the correct type, shouldn't it be RoomReaction
?
|
||
### Automatic detachment on unmount <a id="auto-detach"/> | ||
|
||
For React Native components, when a component using the `ChatRoomProvider` unmounts, the room will automatically detach from the underlying channel and clean up associated resources. This behavior is controlled by the `release` prop on the `ChatRoomProvider`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer the case, release and cleanup are automatic on unmount now :) There is no longer a release prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only time you will need to manually release a room now, is if you aren't using the room provider :)
edca8fa
to
f249200
Compare
A new getting started guide for Chat in React Native using Expo.