@upeex/ads-sdk 1.1.21 → 1.1.22

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/README.md CHANGED
@@ -63,10 +63,19 @@ return (
63
63
  );
64
64
  ```
65
65
 
66
+ ```
67
+
66
68
  **Evite colocar dentro de:**
67
69
  - Componentes que são desmontados condicionalmente (`{show && <AdBanner />}`).
68
70
  - Headers ou Footers com `position: absolute` ou `zIndex` restritivo.
69
71
 
72
+ #### ⚠️ Conflito com Outros Modals (Loading, Alertas)
73
+
74
+ O React Native pode ter problemas ao tentar exibir **dois Modals ao mesmo tempo** (ex: um Loading Spinner e o Anúncio Popup).
75
+ - Se o seu app abre um Modal de "Carregando..." ao entrar na tela, aguarde ele fechar antes de renderizar o anúncio, ou use o anúncio como o próprio loading inicial.
76
+ - O SDK possui `zIndex` alto (9999), mas o sistema operacional (especialmente Android) pode priorizar o último Modal aberto na árvore de componentes.
77
+
78
+
70
79
  ### Props Disponíveis
71
80
 
72
81
  | Prop | Tipo | Descrição |
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useState, useEffect } from 'react';
2
+ import React, { useState, useEffect } from 'react';
3
3
  import { Platform, Dimensions, StyleSheet, View, Text, Modal, TouchableWithoutFeedback, TouchableOpacity, ActivityIndicator, Image, Linking } from 'react-native';
4
4
 
5
5
  async function getSignals() {
@@ -91,6 +91,11 @@ style = {}, debug = false, }) {
91
91
  };
92
92
  const effectiveTypeAds = (_a = (typeAds || typeads)) === null || _a === void 0 ? void 0 : _a.toLowerCase();
93
93
  const isPopup = effectiveTypeAds === 'popup';
94
+ // Track visibility with ref to avoid dependency loops in useEffect
95
+ const isVisibleRef = React.useRef(false);
96
+ useEffect(() => {
97
+ isVisibleRef.current = modalVisible;
98
+ }, [modalVisible]);
94
99
  useEffect(() => {
95
100
  let refreshTimer;
96
101
  const load = async () => {
@@ -135,11 +140,11 @@ style = {}, debug = false, }) {
135
140
  return () => {
136
141
  if (refreshTimer)
137
142
  clearTimeout(refreshTimer);
138
- if (isPopup && modalVisible && debug) {
143
+ if (isPopup && isVisibleRef.current && debug) {
139
144
  console.warn('[UPEEX ADS] Aviso: O componente AdBanner (Popup) foi desmontado enquanto estava visível. Verifique se ele não está dentro de uma View que foi ocultada ou removida da tela.');
140
145
  }
141
146
  };
142
- }, [client, slot, baseUrl, effectiveTypeAds, modalVisible]);
147
+ }, [client, slot, baseUrl, effectiveTypeAds]); // Removed modalVisible to prevent loops
143
148
  // Popup close delay logic
144
149
  const [canClose, setCanClose] = useState(false);
145
150
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upeex/ads-sdk",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Upeex Ads SDK for React Native and universal apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",