2
votes

Recently I tried to add react-native-admob to my app. I got an error while working on ios. Invariant Violation: requireNativeComponent: "RNGADBannerView" was not found in the UIManager.

"react": "16.8.6",
"react-native": "0.60.5",
"react-native-admob": "^2.0.0-beta.5",

I added this to podfile. pod 'Google-Mobile-Ads-SDK' And then, install pod again. cd ios pod install

I also added GADApplicationIdentifier to info.

import {
    AdMobBanner,
  } from 'react-native-admob'


class BannerAds extends Component {

    render() {
    return (

        <AdMobBanner
            style={styles.bottomBanner}
            adSize="banner"
            adUnitID="my app id"
            onAdFailedToLoad={error => console.error(error)}
        />
        // <View>

        // </View>
        )
    }
}
2

2 Answers

0
votes

it looks like react-native-admob package doesn't support autolinking (introduced in React Native 0.60) - it's still necessary to link it manually:

react-native link react-native-admob
0
votes

I want to recommend others to use the latest version of React, React Native, and react-native-admob.

In recent versions, all packages support autolinking.

This really helps us to use packages easily.