Skip to content

Commit 988aad0

Browse files
committed
add property for the ad layout has image or not
1 parent c43ea3f commit 988aad0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import CYNativeImageView from './app/components/CYNativeImageView';
1717
// const unitID = "ca-app-pub-3940256099942544/2247696110" // android image
1818
const unitID = "ca-app-pub-3940256099942544/1044960115" // android video
1919
const dfpUnitId = "/6499/example/native" //Custom Rendering
20+
const cnyesUnitId7 = "/1018855/app_news_headline_native_7"
2021
//#endregion
2122

2223
export default class App extends Component {
@@ -42,7 +43,8 @@ export default class App extends Component {
4243
Native Advanced ca-app-pub-3940256099942544/2247696110
4344
Native Advanced Video ca-app-pub-3940256099942544/1044960115
4445
*/
45-
adColors={['#2200ff00', '#ff0000', '#660000', '#53cd12', '#11000000']}
46+
// adColors={['#2200ff00', '#ff0000', '#660000', '#53cd12', '#11000000']}
47+
adLayoutWithImage={true}
4648
onUnifiedNativeAdLoaded={this.onAdLoaded}
4749
onAdFailedToLoad={this.onAdFailedToLoad}
4850
onAdImpression={this.onAdImpression}

app/components/CYNativeAdView.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
StyleSheet,
88
Platform,
99
} from 'react-native';
10-
import { string, func, arrayOf, number, oneOfType } from 'prop-types';
10+
import propTypes, { func, string } from 'prop-types';
1111

1212
const reloadAdKey = Platform.select({
1313
ios: UIManager.CYNativeAdView.Commands.reloadAd,
@@ -49,7 +49,7 @@ class CYNativeAdView extends Component {
4949

5050
const styles = StyleSheet.create({
5151
natvieAdView: {
52-
height: 167,
52+
height: 104,
5353
width: '100%',
5454

5555
}
@@ -61,7 +61,7 @@ CYNativeAdView.propTypes = {
6161
/**
6262
* ad unit ID provided from admob
6363
*/
64-
adUnitID: string,
64+
adUnitID: propTypes.string,
6565

6666
/**
6767
* color[0] : ad's background color
@@ -71,7 +71,12 @@ CYNativeAdView.propTypes = {
7171
* color[4] : ad's button backgroud color
7272
* e.g. {['#00ffff','#ff00ff', '#660000', '#53cd12', '#66000000']}
7373
*/
74-
adColors: arrayOf(oneOfType([string])),
74+
adColors: propTypes.arrayOf(propTypes.oneOfType([string])),
75+
76+
/*
77+
* has image within this layout
78+
*/
79+
adLayoutWithImage: propTypes.bool,
7580

7681
/**
7782
* indicate that ad has failed to load

0 commit comments

Comments
 (0)