You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using NativeAdView in react-native my ad component . And its not reflecting / removed after some time.This is a random issue which i am facing . below is my code.
This is happening for my app too. It will load ads for about 3 or 4 hours fine, but then it just stops working after that. Every time I try to load ads after it stops working, it doesn't do anything. It doesn't crash but the advertisement area goes blank.
I am using NativeAdView in react-native my ad component . And its not reflecting / removed after some time.This is a random issue which i am facing . below is my code.
useEffect(() => {
if (repositoryName && repositoryName?.length > 0) {
loadAd();
} else {
debounceForFunc(() => {
if (blankFeedImages.length > 0) {
setDummyUri(blankFeedImages[Math.floor(Math.random() * blankFeedImages.length)]);
}
}, 3000);
}
}, [repositoryName]);
return (
<ImageBackground
source={{ uri: uri || dummyUri }}
style={{
width: Dimensions.get("window").width,
height,
backgroundColor: colors.black,
}}
onLoad={() => {
if (dummyUri) {
setShowLoader(false);
}
}}
onError={() => setShowLoader(false)}
blurRadius={uri ? 15 : 0}
>
<View style={{ height }}>
{repositoryName && currentRepository?.current ? (
<NativeAdView
ref={nativeAdViewRef as MutableRefObject}
enableTestMode={env === "dev" || env === "qa"}
repository={currentRepository.current || undefined}
style={styles.container}
onNativeAdLoaded={(ad: NativeAd) => {
setShowLoader(false);
appLogger.warn("Ad Loaded", ad);
setUri(ad?.images?.[0]?.url);
setDummyUri(undefined);
currentAdJSON.current = ad;
setLoaded(true);
trackEvent({ eventName: Events.nativeAdLoaded, eventData: ad });
}}
onAdImpression={() => {
trackEvent({
eventName: Events.nativeAdImpression,
eventData: currentAdJSON,
});
}}
onAdFailedToLoad={(error: any) => {
setShowLoader(false);
setUri(null);
appLogger.error("Failed to load ad", error);
trackEvent({
eventName: Events.nativeAdError,
eventData: error,
});
}}
>
<View
style={{
height: height,
width: Dimensions.get("window").width,
}}
>
{currentItemId === post.id ? (
<ImageView
style={{
width: Dimensions.get("window").width,
height: "40%",
marginTop: 150,
}}
/>
) : (
<View
style={{
width: Dimensions.get("window").width,
height: "70%",
}}
/>
)}
<View
style={{
width: Dimensions.get("window").width,
alignItems: "center",
}}
>
<View style={{ marginBottom: 5 }}>
{uri ? (
) : null}
{showLoader ? (
<ActivityIndicator
size={"small"}
style={{ position: "absolute", top: 0, bottom: 0, left: 0, right: 0 }}
color={colors.blue}
/>
) : null}
) : null}
);
Note : Its working fine with "ImageView" . But i cant use it as i want serve video ads as well. Can you please help me out?
"react-native": "0.71.13",
"react-native-admob-native-ads": "0.6.6",
The text was updated successfully, but these errors were encountered: