Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Presence change event name corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpye committed Nov 1, 2018
1 parent 9fbd12c commit f7d9e01
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,6 @@ class ChatScreen extends Component {
.catch(error => console.error('error', error))
}



render() {
const styles = {
...
Expand Down Expand Up @@ -1128,8 +1126,7 @@ class ChatScreen extends Component {
),
})
},
+ onUserCameOnline: () => this.forceUpdate(),
+ onUserWentOffline: () => this.forceUpdate(),
+ onPresenceChange: () => this.forceUpdate(),
+ onUserJoined: () => this.forceUpdate(),
+ },
})
Expand All @@ -1140,9 +1137,6 @@ class ChatScreen extends Component {
.catch(error => console.error('error', error))
}




render() {
const styles = {
...
Expand Down Expand Up @@ -1184,7 +1178,7 @@ Managing the state of your users in React state can be a bit tricky so we manag

As users connect and disconnect, this property is dynamically updated. In other words, `currentRoom.users` should always refelect the current state of your chat app.

Therefore, when users come online (`userCameOnline`) or go offline (`userWentOffline`) all we have to do is call `forceUpdate` which tells React to evaluate `currentRoom.usrs` and update the UI.
Therefore, when users come online or go offline (`onPresenceChange`), or new users join (`onUserAdded`) all we have to do is call `forceUpdate` which tells React to evaluate `currentRoom.users` and update the UI.

Again, it really boils down to wiring some simple data and events to React components and that's all, folks!

Expand Down

0 comments on commit f7d9e01

Please sign in to comment.