【发布时间】:2019-01-02 10:46:39
【问题描述】:
我正在使用 https://docs.expo.io/versions/latest/sdk/facebook-ads 将 Facebook 广告添加到我的应用中。我正确地遵循了文档,但我的应用主屏幕上看不到 Facebook 广告。
BottomBannerAd.js
import React from 'react';
import { FacebookAds } from 'expo';
const { AdIconView, AdMediaView } = FacebookAds;
class AdComponent extends React.Component {
render() {
return (
<View>
<AdMediaView />
<AdTriggerView>
<Text>{this.props.nativeAd.bodyText}</Text>
</AdTriggerView>
</View>
);
}
}
export default FacebookAds.withNativeAd(AdComponent);
HomeScreen.js
import React from 'react';
import { Image, TextInput, FlatList, StyleSheet, Text, View,
TouchableOpacity, ActivityIndicator, Platform } from 'react-native';
import { NavigationEvents } from 'react-navigation';
import { FacebookAds } from 'expo';
import AdComponent from '../components/BottomBannerAd';
const adsManager = new FacebookAds.NativeAdsManager('xxxxxxxxxxx', 10);
import {
AdMobBanner,
AdMobInterstitial,
AdMobRewarded
} from "expo";
export default class HomeScreen extends React.Component {
render(){
return (
<View style={styles.container}>
...
<View style={styles.tabBarInfoContainer}>
<AdComponent adsManager={adsManager} />
</View>
</View>
)
}
}
我有一个包含广告组件的视图组件。当我添加 Google 广告时,该视图组件运行良好,但不适用于 Facebook 广告。
【问题讨论】:
标签: reactjs facebook react-native expo