Closed IgorBaio closed 7 months ago
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
What happened?
following the documentation, the use of Banner and Interstitial is not appearing
Examples:
Banner: import React, { useEffect } from "react"; import { FeedContainer, GalleryContainer, SearchContainer, InputContainer, InputCheckBox, InputCheckBoxContainer, InputCheckBoxLabel, BannerContainer, } from "./styles"; import { Gallery } from "../../Organisms/Gallery"; import { useFilters } from "../../stores/Filters"; import { colors } from "../../Styles/theme"; import { MaterialIcons } from '@expo/vector-icons'; import { useUser } from "../../stores/User"; import { GenericInput } from "../../Molecules/GenericInput"; import mobileAds, { AppOpenAd, InterstitialAd, RewardedAd, BannerAd, TestIds } from "react-native-google-mobile-ads"; import { heightPercentageToDP } from "react-native-responsive-screen"; import { verifyPlatform } from "../../functions/verifyPlatform";
export function SearchStructure({ navigation }: any) { const { users } = useUser((state) => state); const [search, setSearch] = React.useState("");
const [searchResult, setSearchResult] = React.useState<any[]>(users.filter((user, index) => index < 10) || []);
const { user, setUser } = useUser(state => state)
const [nationality, setNationality] = React.useState(user?.country || "");
const getFilter = () => { let usersAux = users.filter((userList, index) => (userList.displayName.toLowerCase().includes(search.toLowerCase()) || userList.services.join().toLowerCase().includes(search.toLowerCase())) ) if (!!nationality) usersAux = usersAux.filter(userList => userList.country === nationality) usersAux = usersAux.filter((userList, index) => index < 10) setSearchResult(usersAux); }
useEffect(() => { getFilter() }, [search, nationality])
useEffect(() => { setNationality(user.country) }, [user])
return (
); }
Interstitial:
import React, { useEffect } from "react"; import { Text,
HStack, Center, Pressable, } from "native-base"; import { MaterialIcons, AntDesign } from '@expo/vector-icons'; import { useScreen } from "../stores/screen"; import { colors } from "../Styles/theme"; import { useCounterClickAd } from "../stores/CounterClickAd"; import { AdEventType, InterstitialAd } from "react-native-google-mobile-ads"; import { Platform } from "react-native";
interface MyTabBarProps { initialScreen: number; navigation: any; } const verifyPlatform = () => { if (Platform.OS === 'ios') { return 'ca-app-pub-2814259275801960~8712799152' } else if (Platform.OS === 'android') { return 'ca-app-pub-9674908168811233~5829755601' }
return 'ca-app-pub-9674908168811233~5829755601' }
const interstitialAd = InterstitialAd.createForAdRequest(verifyPlatform(), { keywords: ['fashion', 'clothing'], });
export function MyTabBar({ navigation, initialScreen = 0 }: MyTabBarProps) { const { screen = initialScreen, setScreen } = useScreen((state) => state);
const { setClicks, clicks } = useCounterClickAd(state => state) const [interstitialAds, setInterstitialAds] = React.useState(null)
const initInterstitialAd = () => {
// const interstitialAd = InterstitialAd.createForAdRequest(verifyPlatform())
console.log('interstitialAd pre evento', interstitialAd)
interstitialAd.addAdEventListener(AdEventType.LOADED, () => {
setInterstitialAds(interstitialAd)
console.warn('interstitialAd loaded')
}
)
interstitialAd.addAdEventListener(AdEventType.CLOSED, () => {
console.warn('interstitialAd loaded')
}
)
interstitialAd.load()
}
const showInterstitialAd = async () => { console.log('interstitialAds', interstitialAds) if (interstitialAds) { interstitialAds.show() } }
useEffect(() => { initInterstitialAd()
}, [clicks]);
const selectScreen = (page: number, screen: string) => { setScreen(page) console.log('clicks', clicks) if (clicks >= 2) { showInterstitialAd() setClicks(0) } else {
}
return ( <>
); }
Platforms
Android and iOS
React Native Info
Are your using Typescript?
package.json
app.json
ios/Podfile
No response
android/build.gradle
No response
android/app/build.gradle
No response
android/settings.gradle
No response
AndroidManifest.xml
No response