Skip to content

Commit 0607976

Browse files
committed
gone the image view if set property of no image
1 parent a3a1088 commit 0607976

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class App extends Component {
4343
return (
4444
<View style={styles.container}>
4545
<View>
46-
<Text>Custom Rendering Ad Unit Id : {dfpUnitId}</Text>
46+
<Text style={{color: 'black'}}>Custom Rendering Ad Unit Id :</Text><Text>{dfpUnitId}</Text>
4747
</View>
4848
<CYNativeAdView
4949
style={styles.nativeView}
@@ -67,7 +67,7 @@ export default class App extends Component {
6767
</Text>
6868
</View>
6969
<View>
70-
<Text>Custom Template Ad Unit Id : {CNYES_AD_UNIT_ID_7}</Text>
70+
<Text style={{color: 'black'}}>Custom Template Ad Unit Id : </Text><Text>{CNYES_AD_UNIT_ID_7}</Text>
7171
</View>
7272
<CYTemplateAdView
7373
style={styles.nativeView}

android/app/src/main/assets/index.android.bundle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ __d(function(e,t,i,n,r){'use strict';var f=t(r[0]);i.exports=function(e,t){fetch
303303
__d(function(t,r,o,e,u){'use strict';var c=r(u[0]).SourceCode,i=void 0,l='http://localhost:8081/';o.exports=function(){if(void 0===i){var t=c&&c.scriptURL&&c.scriptURL.match(/^https?:\/\/.*?\//);i=t?t[0]:null}return{url:i||l,bundleLoadedFromServer:null!==i}}},302,[15]);
304304
__d(function(e,r,t,n,a){'use strict';var s=r(a[0]),o=r(a[1]).SourceCode,c=void 0;t.exports=function(t){var n,u,i,d,f;return regeneratorRuntime.async(function(p){for(;;)switch(p.prev=p.next){case 0:if(c||(c=e.fetch||r(a[2]).fetch),(n=s()).bundleLoadedFromServer){p.next=4;break}throw new Error('Bundle was not loaded from the packager');case 4:return u=t,o.scriptURL&&(i=!1,u=t.map(function(e){return i||(r=e.file,/^http/.test(r)||!/[\\/]/.test(r))?(i=!0,e):babelHelpers.extends({},e,{file:o.scriptURL});var r})),p.next=8,regeneratorRuntime.awrap(c(n.url+'symbolicate',{method:'POST',body:JSON.stringify({stack:u})}));case 8:return d=p.sent,p.next=11,regeneratorRuntime.awrap(d.json());case 11:return f=p.sent,p.abrupt("return",f.stack);case 13:case"end":return p.stop()}},null,this)}},303,[302,15,76]);
305305
__d(function(_,t,E,s,O){'use strict';var R=t(O[0]).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;E.exports=R.takeSnapshot},304,[39]);
306-
__d(function(e,t,n,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var l=t(i[0]),a=babelHelpers.interopRequireDefault(l),d=t(i[1]),r=t(i[2]),s=babelHelpers.interopRequireDefault(r),c=t(i[3]),u=babelHelpers.interopRequireDefault(c),p=t(i[4]),f=(babelHelpers.interopRequireDefault(p),'/1018855/app_news_headline_native_7/app_news_headline_native_7_Android'),A=(function(e){function t(e){babelHelpers.classCallCheck(this,t);var n=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onAdLoaded=function(){console.log("App onAdLoaded from ")},n.onAdFailedToLoad=function(){console.log("App onAdFailedToLoad")},n.onAdImpression=function(){console.log("App onAdImpression")},n.onAdClicked=function(){console.log('App onAdClicked')},n.onAdLeftApplication=function(){console.log("App onAdLeftApplication")},n.onPress=function(){n.child.requestNativeAd(),n.setState({count:n.state.count+1},function(){console.log("App press on text view")})},n.state={count:0},n}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){console.log("App componentDidMount")}},{key:"render",value:function(){var e=this;return a.default.createElement(d.View,{style:m.container},a.default.createElement(d.View,null,a.default.createElement(d.Text,null,"Custom Rendering Ad Unit Id : ","/6499/example/native")),a.default.createElement(s.default,{style:m.nativeView,adUnitID:"/6499/example/native",adColors:['#2200ff00','#ff0000','#660000','#53cd12','#11000000'],adLayoutWithImage:!0,onUnifiedNativeAdLoaded:this.onAdLoaded,onAdFailedToLoad:this.onAdFailedToLoad,onAdImpression:this.onAdImpression,onAdClicked:this.onAdClicked,onAdLeftApplication:this.onAdLeftApplication,onRef:function(t){return e.child=t}}),a.default.createElement(d.TouchableOpacity,{style:m.button,onPress:this.onPress},a.default.createElement(d.Text,null,"Refresh Ad")),a.default.createElement(d.View,{style:[m.countContainer]},a.default.createElement(d.Text,{style:[m.countText]},0!==this.state.count?this.state.count:null)),a.default.createElement(d.View,null,a.default.createElement(d.Text,null,"Custom Template Ad Unit Id : ",f)),a.default.createElement(u.default,{style:m.nativeView,adUnitID:f,adLayoutWithImage:!0,onUnifiedNativeAdLoaded:this.onAdLoaded,onAdFailedToLoad:this.onAdFailedToLoad,onAdImpression:this.onAdImpression,onAdClicked:this.onAdClicked,onAdLeftApplication:this.onAdLeftApplication,onRef:function(t){return e.child=t}}))}}]),t})(l.Component);o.default=A;var m=d.StyleSheet.create({container:{flex:1,alignItems:'center',paddingHorizontal:10,marginTop:20},text:{width:'100%',color:'black',backgroundColor:'green',justifyContent:'center',alignItems:'center',padding:10},nativeView:{flex:1,justifyContent:'flex-start'},natvieImageView:{height:120,width:120},button:{alignItems:'center',backgroundColor:'#DDDDDD',padding:10},countContainer:{alignItems:'center',padding:10},countText:{color:'#FF00FF'}})},305,[101,12,306,307,308]);
306+
__d(function(e,t,n,o,l){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var a=t(l[0]),i=babelHelpers.interopRequireDefault(a),d=t(l[1]),r=t(l[2]),s=babelHelpers.interopRequireDefault(r),c=t(l[3]),u=babelHelpers.interopRequireDefault(c),p=t(l[4]),f=(babelHelpers.interopRequireDefault(p),'/1018855/app_news_headline_native_7/app_news_headline_native_7_Android'),A=(function(e){function t(e){babelHelpers.classCallCheck(this,t);var n=babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onAdLoaded=function(){console.log("App onAdLoaded from ")},n.onAdFailedToLoad=function(){console.log("App onAdFailedToLoad")},n.onAdImpression=function(){console.log("App onAdImpression")},n.onAdClicked=function(){console.log('App onAdClicked')},n.onAdLeftApplication=function(){console.log("App onAdLeftApplication")},n.onPress=function(){n.child.requestNativeAd(),n.setState({count:n.state.count+1},function(){console.log("App press on text view")})},n.state={count:0},n}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){console.log("App componentDidMount")}},{key:"render",value:function(){var e=this;return i.default.createElement(d.View,{style:m.container},i.default.createElement(d.View,null,i.default.createElement(d.Text,{style:{color:'black'}},"Custom Rendering Ad Unit Id :"),i.default.createElement(d.Text,null,"/6499/example/native")),i.default.createElement(s.default,{style:m.nativeView,adUnitID:"/6499/example/native",adColors:['#2200ff00','#ff0000','#660000','#53cd12','#11000000'],adLayoutWithImage:!0,onUnifiedNativeAdLoaded:this.onAdLoaded,onAdFailedToLoad:this.onAdFailedToLoad,onAdImpression:this.onAdImpression,onAdClicked:this.onAdClicked,onAdLeftApplication:this.onAdLeftApplication,onRef:function(t){return e.child=t}}),i.default.createElement(d.TouchableOpacity,{style:m.button,onPress:this.onPress},i.default.createElement(d.Text,null,"Refresh Ad")),i.default.createElement(d.View,{style:[m.countContainer]},i.default.createElement(d.Text,{style:[m.countText]},0!==this.state.count?this.state.count:null)),i.default.createElement(d.View,null,i.default.createElement(d.Text,{style:{color:'black'}},"Custom Template Ad Unit Id : "),i.default.createElement(d.Text,null,f)),i.default.createElement(u.default,{style:m.nativeView,adUnitID:f,adLayoutWithImage:!1,onUnifiedNativeAdLoaded:this.onAdLoaded,onAdFailedToLoad:this.onAdFailedToLoad,onAdImpression:this.onAdImpression,onAdClicked:this.onAdClicked,onAdLeftApplication:this.onAdLeftApplication,onRef:function(t){return e.child=t}}))}}]),t})(a.Component);o.default=A;var m=d.StyleSheet.create({container:{flex:1,alignItems:'center',paddingHorizontal:10,marginTop:20},text:{width:'100%',color:'black',backgroundColor:'green',justifyContent:'center',alignItems:'center',padding:10},nativeView:{flex:1,justifyContent:'flex-start'},natvieImageView:{height:120,width:120},button:{alignItems:'center',backgroundColor:'#DDDDDD',padding:10},countContainer:{alignItems:'center',padding:10},countText:{color:'#FF00FF'}})},305,[101,12,306,307,308]);
307307
__d(function(e,t,n,i,a){Object.defineProperty(i,"__esModule",{value:!0});var o=t(a[0]),r=babelHelpers.interopRequireDefault(o),l=t(a[1]),s=t(a[2]),d=babelHelpers.interopRequireDefault(s),u=(function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){this.requestNativeAd(),this.props.onRef(this)}},{key:"componentWillUnmount",value:function(){this.props.onRef(void 0)}},{key:"requestNativeAd",value:function(){l.UIManager.dispatchViewManagerCommand((0,l.findNodeHandle)(this.nativeAdViewRef),1,null)}},{key:"render",value:function(){var e=this;return r.default.createElement(p,babelHelpers.extends({},this.props,{style:f.natvieAdView,ref:function(t){return e.nativeAdViewRef=t}}))}}]),t})(o.Component),f=l.StyleSheet.create({natvieAdView:{height:112,width:'100%'}});u.propTypes=babelHelpers.extends({},l.ViewPropTypes,{adUnitID:d.default.string,adColors:d.default.arrayOf(d.default.oneOfType([s.string])),adLayoutWithImage:d.default.bool,onAdFailedToLoad:s.func,onAdClicked:s.func,onAdClosed:s.func,onAdImpression:s.func,onAdLeftApplication:s.func,onUnifiedNativeAdLoaded:s.func});var p=(0,l.requireNativeComponent)('CYNativeAdView',u);i.default=u},306,[101,12,108]);
308308
__d(function(e,t,n,i,o){Object.defineProperty(i,"__esModule",{value:!0});var a=t(o[0]),r=babelHelpers.interopRequireDefault(a),l=t(o[1]),s=t(o[2]),u=babelHelpers.interopRequireDefault(s),d=(function(e){function t(){return babelHelpers.classCallCheck(this,t),babelHelpers.possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"componentDidMount",value:function(){this.requestNativeAd(),this.props.onRef(this)}},{key:"componentWillUnmount",value:function(){this.props.onRef(void 0)}},{key:"requestNativeAd",value:function(){l.UIManager.dispatchViewManagerCommand((0,l.findNodeHandle)(this.nativeAdViewRef),1,null)}},{key:"render",value:function(){var e=this;return r.default.createElement(f,babelHelpers.extends({},this.props,{style:p.natvieAdView,ref:function(t){return e.nativeAdViewRef=t}}))}}]),t})(a.Component),p=l.StyleSheet.create({natvieAdView:{height:112,width:'100%'}});d.propTypes=babelHelpers.extends({},l.ViewPropTypes,{adUnitID:u.default.string,adLayoutWithImage:u.default.bool,onAdFailedToLoad:s.func,onAdClicked:s.func,onAdClosed:s.func,onAdImpression:s.func,onAdLeftApplication:s.func,onUnifiedNativeAdLoaded:s.func});var f=(0,l.requireNativeComponent)('CYTemplateAdView',d);i.default=d},307,[101,12,108]);
309309
__d(function(e,r,t,l,n){Object.defineProperty(l,"__esModule",{value:!0});var s=r(n[0]),a=babelHelpers.interopRequireDefault(s),i=r(n[1]),o=(function(e){function r(){return babelHelpers.classCallCheck(this,r),babelHelpers.possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this))}return babelHelpers.inherits(r,e),babelHelpers.createClass(r,[{key:"render",value:function(){var e=this;return a.default.createElement(p,babelHelpers.extends({},this.props,{ref:function(r){return e.nativeImageViewRef=r}}))}}]),r})(s.Component);o.propTypes=babelHelpers.extends({},i.ViewPropTypes);var p=(0,i.requireNativeComponent)('RNImageView',o);l.default=o},308,[101,12]);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@��_e��h;Gů�u
1+
�ִs9H�-���DΔ`!n�

android/app/src/main/java/com/anue/rn/nativead/module/CYNativeCustomTemplateAdView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private void sendEvent(String name, @Nullable WritableMap event) {
201201

202202
public void setHasImage(boolean hasImage) {
203203
if (mediaContainer != null) {
204-
mediaContainer.setVisibility(hasImage ? VISIBLE : INVISIBLE);
204+
mediaContainer.setVisibility(hasImage ? VISIBLE : GONE);
205205
}
206206
}
207207

0 commit comments

Comments
 (0)