Comments (6)
I think it should work in a modal, have you tried setting the height of the NativeAdView equal to the height of the device? then adding components like any other React Native View???
from react-native-admob-native-ads.
Yes i do it,
but i can't load the Ad in Modal idk why!
before give it a full width & height it's work
and i'm sure the AdUnitsID work
and when i use onAdLoaded
it's log the ad is loaded
here's my code,
Ad Component
const {height, width} = Dimensions.get('window');
const AdComponent = props => {
const _onAdFailedToLoad = event => {
console.log(event.nativeEvent);
};
const _onAdLoaded = () => {
console.log('Ad has loaded');
};
return (
<>
<View
style={{
flex: 1,
}}>
<NativeAdView
onAdLoaded={_onAdLoaded}
onAdFailedToLoad={_onAdFailedToLoad}
style={{
width: width,
alignSelf: 'center',
height: height * 0.87,
backgroundColor: '#999',
}}
adUnitID="ca-app-pub-3940256099942544/2247696110" // TEST adUnitID
/>
</View>
</>
);
}
export default AdComponent;
Here's a modal in Home Screen
const RenderFullAdd = props => {
return (
<Modal
style={{
margin: 0,
alignItems: 'center',
}}
isVisible={props.isVisible}
onBackdropPress={props.closeModal}
onBackButtonPress={props.closeModal}
useNativeDriver={true}
animationIn="slideInUp"
animationOut="slideOutDown"
animationInTiming={400}
animationOutTiming={400}
coverScreen={true}
backdropColor="#000">
<View
style={{
backgroundColor: '#121212',
borderRadius: 10,
height: height * 0.9,
width: width,
margin: 20,
padding: 10,
alignItems: 'center',
justifyContent: 'center',
}}>
<AdComponent />
</View>
</Modal>
);
};
// render it
<View>
....
<RenderFullAdd
closeModal={() =>
this.setState({isVisible: false}, () =>
console.log('back?'),
)
}
isVisible={this.state.isVisible}
/>
...
</View>
from react-native-admob-native-ads.
I'm trying your code, the Ad appears with me,
but yes as you say it does not take the full size.
<NativeAdView
style={{
width: width,
alignSelf: 'center',
height: height * 0.87,
}}
adUnitID="ca-app-pub-3940256099942544/2247696110" // TEST adUnitID
/>
@ammarahm-ed Check this Shot
from react-native-admob-native-ads.
@anastely @Dev-AS1 It is working for me here properly, If you want to fill the whole screen, you need to add a media view etc and set your components inside the Modal accordingly...
from react-native-admob-native-ads.
@ammarahm-ed Do you have a media view in this lib?
from react-native-admob-native-ads.
Yea check the docs @anastely , You have to design your ad accordingly, the design in example is for a simple banner ad.
from react-native-admob-native-ads.
Related Issues (20)
- Clicking on the Ad shows different Ad detail
- Clicking on the Ad shows different Ad detail HOT 4
- I have added adchoicesPlacement but adchoices icon is not showing HOT 2
- I use NativeMediaView on iOS, but "Asset uses ImageView, not MediaView" is showing. HOT 13
- Invalid template ID: -1 affecting 40% of android user base HOT 5
- Getting template ID error... {"code": 0, "domain": "com.google.android.gms.ads", "message": "Invalid template ID: -1"} HOT 4
- [Question] Requested size
- NEED AN URGENT UPDATE (NOT WORKING)
- how to close native ad or render another ad?
- Adbadge, Headline, CallToActionView etc are showing in IOS but not showing in android HOT 1
- Successfully patched Failure to build "no visible @interface for 'GADRequestConfiguration' declares the selector 'tagForChildDirectedTreatment:'" HOT 4
- ERROR Ad failed to load {"code": 0, "domain": "com.google.android.gms.ads", "message": "Internal error."} HOT 5
- The Components Are Not Appearing
- "code": 0, "domain": "com.google.android.gms.ads", "message": "Internal error." HOT 3
- NativeAdView is not loading properly.
- Please Update NPM package with latest version HOT 2
- Component 'RNGADNativeView' re-registered bubbling event 'topAdLoaded' as a direct event HOT 1
- Expo EAS Build Not Working
- requestNonPersonalizedAdsOnly HOT 8
- How to reload the ad when navigate the screen or kill the app and then reopen the app the ad is reload and when click on ad and then reopen the app show new ad
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-admob-native-ads.