@poolse/react-native 2.8.3 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5236,7 +5236,9 @@ function useVoipCalls({
5236
5236
  const staleRef = useRef(staleAfterMs);
5237
5237
  staleRef.current = staleAfterMs;
5238
5238
  const ready = useRef(Promise.resolve());
5239
+ const answered = useRef(/* @__PURE__ */ new Set());
5239
5240
  const dismiss = useRef((callId) => {
5241
+ answered.current.delete(callId);
5240
5242
  if (!shown.current.has(callId)) return;
5241
5243
  shown.current.delete(callId);
5242
5244
  try {
@@ -5316,6 +5318,7 @@ function useVoipCalls({
5316
5318
  }));
5317
5319
  callKeep.addEventListener("answerCall", (({ callUUID }) => {
5318
5320
  const call = shown.current.get(callUUID);
5321
+ answered.current.add(callUUID);
5319
5322
  try {
5320
5323
  callKeep.setCurrentCallActive?.(callUUID);
5321
5324
  } catch {
@@ -5333,8 +5336,10 @@ function useVoipCalls({
5333
5336
  }));
5334
5337
  callKeep.addEventListener("endCall", (({ callUUID }) => {
5335
5338
  const call = shown.current.get(callUUID);
5339
+ const wasAnswered = answered.current.has(callUUID);
5336
5340
  shown.current.delete(callUUID);
5337
- if (!call) {
5341
+ answered.current.delete(callUUID);
5342
+ if (!call || wasAnswered) {
5338
5343
  void handlers.current.calls?.hangUp();
5339
5344
  return;
5340
5345
  }