@poolse/react-native 2.8.3 → 2.9.0

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.cjs CHANGED
@@ -5263,7 +5263,9 @@ function useVoipCalls({
5263
5263
  const staleRef = react.useRef(staleAfterMs);
5264
5264
  staleRef.current = staleAfterMs;
5265
5265
  const ready = react.useRef(Promise.resolve());
5266
+ const answered = react.useRef(/* @__PURE__ */ new Set());
5266
5267
  const dismiss = react.useRef((callId) => {
5268
+ answered.current.delete(callId);
5267
5269
  if (!shown.current.has(callId)) return;
5268
5270
  shown.current.delete(callId);
5269
5271
  try {
@@ -5343,6 +5345,7 @@ function useVoipCalls({
5343
5345
  }));
5344
5346
  callKeep.addEventListener("answerCall", (({ callUUID }) => {
5345
5347
  const call = shown.current.get(callUUID);
5348
+ answered.current.add(callUUID);
5346
5349
  try {
5347
5350
  callKeep.setCurrentCallActive?.(callUUID);
5348
5351
  } catch {
@@ -5360,8 +5363,10 @@ function useVoipCalls({
5360
5363
  }));
5361
5364
  callKeep.addEventListener("endCall", (({ callUUID }) => {
5362
5365
  const call = shown.current.get(callUUID);
5366
+ const wasAnswered = answered.current.has(callUUID);
5363
5367
  shown.current.delete(callUUID);
5364
- if (!call) {
5368
+ answered.current.delete(callUUID);
5369
+ if (!call || wasAnswered) {
5365
5370
  void handlers.current.calls?.hangUp();
5366
5371
  return;
5367
5372
  }