React native 如何在谷歌广告中为React原生应用添加风格定制?
我目前正在使用下面的软件包。但我未能在我的React native 如何在谷歌广告中为React原生应用添加风格定制?,react-native,admob,babeljs,googleads-mobile-unity,React Native,Admob,Babeljs,Googleads Mobile Unity,我目前正在使用下面的软件包。但我未能在我的AdMobBanner组件中添加样式定制。请告知是否有其他软件包可用于谷歌广告定制或任何其他支持定制的平台广告 import React,{PureComponent}来自'React'; 从“react native”导入{ScrollView,StyleSheet,View}; 从'react native admob'导入{AdMobBanner}; const BannerExample=({style,title,children,…pro
AdMobBanner
组件中添加样式定制。请告知是否有其他软件包可用于谷歌广告定制或任何其他支持定制的平台广告
import React,{PureComponent}来自'React';
从“react native”导入{ScrollView,StyleSheet,View};
从'react native admob'导入{AdMobBanner};
const BannerExample=({style,title,children,…props})=>(
{儿童}
);
const adUnitID='ca-app-pub-3940256099942544/2934735716';
导出默认类GoogleAdsCompo扩展了PureComponent{
render(){
返回(
(这个。_smartBannerExample=el)}
/>
);
}
}
const styles=StyleSheet.create({
例如:{
填充垂直:10,
为内容辩护:“中心”,
对齐项目:“居中”,
},
标题:{
差额:10,
尺寸:20,
},
});
import React, { PureComponent } from 'react';
import { ScrollView, StyleSheet, View } from 'react-native';
import { AdMobBanner } from 'react-native-admob';
const BannerExample = ({ style, title, children, ...props }) => (
<View {...props} style={[styles.example, style]}>
<View>{children}</View>
</View>
);
const adUnitID = 'ca-app-pub-3940256099942544/2934735716';
export default class GoogleAdsCompo extends PureComponent {
render() {
return (
<ScrollView>
<BannerExample title="Smart Banner">
<AdMobBanner
adSize="mediumRectangle"
adUnitID={adUnitID}
ref={el => (this._smartBannerExample = el)}
/>
</BannerExample>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
example: {
paddingVertical: 10,
justifyContent: 'center',
alignItems: 'center',
},
title: {
margin: 10,
fontSize: 20,
},
});