sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 532 forks source link

[Question] is it possible to render ads in a flatlist ? #468

Closed abdullahoday710 closed 4 years ago

abdullahoday710 commented 4 years ago

My app has a feed view and i need to serve ads there is it possible to render ads there using this library ? if so please tell me how because i didn't find anything.

Rob2k9 commented 4 years ago

Hi yes it is

you can actually use ItemSeparatorComponent to place an ad between each item on a colum flat list if you dont want one being placed after every item simply implament a function that counts how many items are in the list and place the ad every 5 or so items

if you are using a row its the same kind of thing the issue when you are going to have errors with is when you use a grid layout or if you load to many ads into the list it will slow things down a lot

abdullahoday710 commented 4 years ago

you can actually use ItemSeparatorComponent to place an ad between each item on a colum flat list

Hi, Thank you for your response, one more question, what type of ad should i use ? because native ads are not supported yet.

Rob2k9 commented 4 years ago

banner ads are the best if your using a vertical list if your using a horizontal list then you want a small banner or rectangle

ursnj commented 4 years ago

You can keep ads in flatlist using renderItem() function, keep your logic in that function to display the Ads.

vinaynb-at commented 4 years ago

@ursNj according to admob docs they don't recommend placing banner ads in scrolling area. Also banner ads should not imitate your content and should be placed distinctly seperate from apps interactive area. So won't your solution go against these guidelines and result in suspension from admob ?

ursnj commented 4 years ago

@vinaynb-at , to be frank im not aware of this policy, but i have placed ads in flatlist its working fine and i didnt faced any issue. also i saw in many apps placed ads in scrolling area, dont worry about this policy, have fun.

VallVall commented 4 years ago

Hi yes it is

you can actually use ItemSeparatorComponent to place an ad between each item on a colum flat list if you dont want one being placed after every item simply implament a function that counts how many items are in the list and place the ad every 5 or so items

if you are using a row its the same kind of thing the issue when you are going to have errors with is when you use a grid layout or if you load to many ads into the list it will slow things down a lot

@Rob2k9 can you show me how show ItemSeparatorComponent after every tenth element?

I have numColums={2}

can you help me?

I really do not understand how do this

Saammode commented 2 years ago

You can use admob native ads, that just look like your renderItem on flatlist. Check this tutorial on How to add native ads to flatlist

WAQAZ0178 commented 1 year ago

I have numColums={2}

can you help me?

actually, I place the ads it's working but the flatList shows another item on the left side because of numColums={2}

WAQAZ0178 commented 1 year ago

I have numColums={2}

can you help me?

actually, I place the ads it's working but the flatList shows another item on the left side because of numColums={2}

i want if I'm showing ads the its show only one item in row