Skip to content

Commit

Permalink
Merge pull request react-native-webrtc#315 from zxcpoiu/fix_initial_l…
Browse files Browse the repository at this point in the history
…istener

fix: not to add `didLoadWithEvents` in constructor
  • Loading branch information
manuquentin authored Nov 30, 2020
2 parents 523f683 + 001c79b commit 60b2620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,11 @@ Called as soon as JS context initializes if there were some actions performed by
Since iOS 13, you must display incoming call on receiving PushKit push notification. But if app was killed, it takes some time to create JS context. If user answers the call (or ends it) before JS context has been initialized, user actions will be passed as events array of this event. Similar situation can happen if user would like to start a call from Recents or similar iOS app, assuming that your app was in killed state.

```js
// register `didLoadWithEvents` somewhere early in your app when it is ready to handle callkeep events.

RNCallKeep.addEventListener('didLoadWithEvents', (events) => {
// see example usage in https://github.com/react-native-webrtc/react-native-callkeep/pull/169
// `events` is passed as an Array chronologically, handle or ignore events based on the app's logic
// see example usage in https://github.com/react-native-webrtc/react-native-callkeep/pull/169 or https://github.com/react-native-webrtc/react-native-callkeep/pull/205
});
```

Expand Down
6 changes: 0 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ class RNCallKeep {

constructor() {
this._callkeepEventHandlers = new Map();

this.addEventListener('didLoadWithEvents', (events) => {
events.forEach(event => {
emit(event.name, event.data);
});
});
}

addEventListener = (type, handler) => {
Expand Down

0 comments on commit 60b2620

Please sign in to comment.