【问题标题】:How to Place admob Banner ads between data fetched from firebase如何在从 firebase 获取的数据之间放置 admob 横幅广告
【发布时间】:2019-10-26 08:01:03
【问题描述】:

我想在从 FireBase 获取的数据之间显示横幅广告,这是我的代码:

   showdata = imgs =>
    imgs.articles
      ? imgs.articles.map((item, i) => (
          <TouchableWithoutFeedback onPress={() => this.onPlay(item)} key={i}>
            <View style={styles.cardContainer}>
              <View style={styles.contentCard}>
                <Image
                  source={{uri: `${item.image}`}}
                  style={styles.imagestyle}
                  resizeMode="cover"
                />
              </View>
              <View style={styles.contentCard}>
                <Text style={styles.titleCard}>
                  {item.name}
                </Text>
              </View>
            </View>
          </TouchableWithoutFeedback>
        ))
      : null;

我想在每 3 张卡片之后放置横幅广告。我正在使用 Redux 和 firebase

【问题讨论】:

    标签: firebase react-native react-redux admob


    【解决方案1】:
    customRenderRow = ({ item, index }) => {
       if (index !== 0 && index % 3 === 0) {
          return (
             <View>
               <AdmobBanner />
    
               ...card
             </View>
          );
       }
       return (
           ...card
       );
    }
    render () {
      return (
         <Flatlist
           ...
           renderItem={this.customRenderRow}
         />
      );
    }
    
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多