@upeex/ads-sdk 1.1.19 → 1.1.21
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 +33 -8
- package/dist/index.js +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,15 +36,37 @@ Exibe um anúncio em tela cheia (modal) sobrepondo o conteúdo.
|
|
|
36
36
|
- **Bloqueio de 5 segundos:** O usuário deve aguardar 5 segundos antes de fechar.
|
|
37
37
|
- **Spinner:** Um indicador de carregamento aparece durante o bloqueio.
|
|
38
38
|
- **Sem Auto-Refresh:** O popup carrega apenas uma vez.
|
|
39
|
+
- **Visual:** Ocupa toda a tela (transparente na StatusBar) e a imagem é redimensionada para 90% da largura.
|
|
40
|
+
|
|
41
|
+
#### ⚠️ Onde Colocar o Popup (Importante!)
|
|
42
|
+
|
|
43
|
+
Para garantir que o popup abra corretamente e não sobreponha outros Modals de forma errada, **coloque o componente no final do seu container principal**, logo antes de fechar a view da tela.
|
|
44
|
+
|
|
45
|
+
**Exemplo Correto:**
|
|
39
46
|
|
|
40
47
|
```javascript
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
return (
|
|
49
|
+
<View style={{ flex: 1 }}> {/* Seu Container Principal (View, SafeAreaView, etc) */}
|
|
50
|
+
<Header />
|
|
51
|
+
<Conteudo />
|
|
52
|
+
|
|
53
|
+
{/* Outros Modals do seu App */}
|
|
54
|
+
<Modal visible={isLoading}>...</Modal>
|
|
55
|
+
|
|
56
|
+
{/* ✅ COLOCAR AQUI, NO FINAL: */}
|
|
57
|
+
<AdBanner
|
|
58
|
+
client="SEU_ID_CLIENTE"
|
|
59
|
+
slot="SEU_ID_SLOT"
|
|
60
|
+
typeads="popup"
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
46
64
|
```
|
|
47
65
|
|
|
66
|
+
**Evite colocar dentro de:**
|
|
67
|
+
- Componentes que são desmontados condicionalmente (`{show && <AdBanner />}`).
|
|
68
|
+
- Headers ou Footers com `position: absolute` ou `zIndex` restritivo.
|
|
69
|
+
|
|
48
70
|
### Props Disponíveis
|
|
49
71
|
|
|
50
72
|
| Prop | Tipo | Descrição |
|
|
@@ -54,10 +76,13 @@ Exibe um anúncio em tela cheia (modal) sobrepondo o conteúdo.
|
|
|
54
76
|
| `typeads` | `'banner' \| 'popup'` | Define o formato. Padrão é `'banner'`. |
|
|
55
77
|
| `theme` | `'light' \| 'dark'` | Define o tema (cores de fundo). Padrão `'light'`. |
|
|
56
78
|
| `baseUrl` | `string` | URL base da API (opcional). |
|
|
57
|
-
| `debug` | `boolean` | Ativa logs no console
|
|
79
|
+
| `debug` | `boolean` | Ativa logs no console (avisa se o componente foi desmontado erradamente). |
|
|
58
80
|
|
|
59
81
|
## Solução de Problemas
|
|
60
82
|
|
|
61
83
|
- **Erro "Cannot find module 'react-native'"**: Certifique-se de que `react` e `react-native` estão instalados no seu projeto.
|
|
62
|
-
- **Popup não abre**:
|
|
63
|
-
|
|
84
|
+
- **Popup não abre**:
|
|
85
|
+
1. Verifique se `typeads="popup"`.
|
|
86
|
+
2. Ative `debug={true}` e olhe o console. Se aparecer "Nenhum anúncio disponível", é normal.
|
|
87
|
+
3. Se aparecer o aviso "O componente foi desmontado...", mova o `<AdBanner />` para a raiz da tela.
|
|
88
|
+
- **Sobreposição**: O popup possui `zIndex: 9999` e `elevation: 11`. Se ainda estiver atrás de algum elemento, verifique se o pai não tem um `zIndex` maior.
|
package/dist/index.js
CHANGED
|
@@ -135,8 +135,11 @@ style = {}, debug = false, }) {
|
|
|
135
135
|
return () => {
|
|
136
136
|
if (refreshTimer)
|
|
137
137
|
clearTimeout(refreshTimer);
|
|
138
|
+
if (isPopup && modalVisible && debug) {
|
|
139
|
+
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
|
+
}
|
|
138
141
|
};
|
|
139
|
-
}, [client, slot, baseUrl, effectiveTypeAds]);
|
|
142
|
+
}, [client, slot, baseUrl, effectiveTypeAds, modalVisible]);
|
|
140
143
|
// Popup close delay logic
|
|
141
144
|
const [canClose, setCanClose] = useState(false);
|
|
142
145
|
useEffect(() => {
|
|
@@ -176,12 +179,12 @@ style = {}, debug = false, }) {
|
|
|
176
179
|
return debug ? (jsx(View, { style: [styles.upeexContainer, styles.upeexLoading], children: jsx(Text, { style: styles.upeexLoadingText, children: "Carregando an\u00FAncio\u2026" }) })) : null;
|
|
177
180
|
}
|
|
178
181
|
if (isPopup) {
|
|
179
|
-
return (jsx(Modal, { transparent: true, visible: modalVisible, onRequestClose: handleClose, animationType: "fade", children: jsx(TouchableWithoutFeedback, { onPress: handleClose, children: jsx(View, { style: styles.upeexOverlay, children: jsx(TouchableWithoutFeedback, { onPress: () => { }, children: jsxs(View, { style: [
|
|
182
|
+
return (jsx(Modal, { transparent: true, visible: modalVisible, onRequestClose: handleClose, animationType: "fade", statusBarTranslucent: true, hardwareAccelerated: true, children: jsx(TouchableWithoutFeedback, { onPress: handleClose, children: jsx(View, { style: styles.upeexOverlay, children: jsx(TouchableWithoutFeedback, { onPress: () => { }, children: jsxs(View, { style: [
|
|
180
183
|
styles.upeexPopupContainer,
|
|
181
184
|
theme === 'dark' && styles.upeexDark,
|
|
182
185
|
], children: [canClose ? (jsx(TouchableOpacity, { onPress: handleClose, style: styles.upeexCloseButton, children: jsx(Text, { style: styles.upeexCloseText, children: "\u2715" }) })) : (jsx(View, { style: styles.upeexCloseButton, children: jsx(ActivityIndicator, { size: "small", color: "#999" }) })), jsx(TouchableOpacity, { activeOpacity: 0.9, onPress: handlePress, children: jsx(Image, { source: { uri: ad.image }, style: {
|
|
183
|
-
width:
|
|
184
|
-
height:
|
|
186
|
+
width: Dimensions.get('window').width * 0.9,
|
|
187
|
+
height: Dimensions.get('window').height * 0.8,
|
|
185
188
|
resizeMode: 'contain',
|
|
186
189
|
} }) })] }) }) }) }) }));
|
|
187
190
|
}
|