Reputation: 81
react-native-admob not working in my RN < 57.8 app
I tried :
npm install react-native-admob@next --save
npm install @types/react-native-admob
npm i react-native-admob -S
npm install
react-native link
declare module 'react-native-admob'
updated tools to 28.0.3
import { AdMobBanner } from 'react-native-admob';
export default class Intro extends React.Component {
bannerError(err){
console.log(err)
}
render() {
return (
<Container style={styles.container}>
<ImageBackground style={{width:'100%',height:'100%',}} source= {require('../assets/start1.jpg')}>
<AdMobBanner
bannerSize="fullBanner"
adUnitID="ca-app-pub-3940256099942544/2934735716"
testDeviceID="EMULATOR"
didFailToReceiveAdWithError={this.bannerError} />
</ImageBackground >
</Container>
);
}
}
Error
Could not find a declaration file for module 'react-native-admob'. 'e:/react/almustaqbal/node_modules/react-native-admob/index.js' implicitly has an 'any' type. Try
npm install @types/react-native-admob
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-native-admob';
ts(7016)
Upvotes: 3
Views: 1195
Reputation: 81
After trying numerous times i guess react-native-admob isn't working in RN<57.8
So i found another way working in RN<57.8 is :
react-native-firebase
i found this web for good explanation https://dev-yakuza.github.io/en/react-native/react-native-firebase-admob/
Upvotes: 1