@upeex/ads-sdk 1.1.21 → 1.1.23

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.
Files changed (3) hide show
  1. package/README.md +9 -0
  2. package/dist/index.js +19 -14
  3. package/package.json +1 -1
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(() => {
@@ -231,24 +236,24 @@ const styles = StyleSheet.create({
231
236
  elevation: 10,
232
237
  },
233
238
  upeexPopupContainer: {
234
- backgroundColor: '#fff',
235
- padding: 20,
236
- borderRadius: 10,
239
+ backgroundColor: 'transparent',
240
+ padding: 0,
237
241
  alignItems: 'center',
238
242
  position: 'relative',
239
- elevation: 11,
240
- shadowColor: '#000',
241
- shadowOffset: { width: 0, height: 2 },
242
- shadowOpacity: 0.25,
243
- shadowRadius: 3.84,
244
243
  zIndex: 10000,
245
244
  },
246
245
  upeexCloseButton: {
247
246
  position: 'absolute',
248
- top: 5,
249
- right: 5,
247
+ top: -10,
248
+ right: -10,
250
249
  zIndex: 1,
251
- padding: 5,
250
+ backgroundColor: '#fff',
251
+ borderRadius: 15,
252
+ width: 30,
253
+ height: 30,
254
+ justifyContent: 'center',
255
+ alignItems: 'center',
256
+ elevation: 5,
252
257
  },
253
258
  upeexCloseText: {
254
259
  fontSize: 18,
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.23",
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",