react-native-adbannerview
This component serves as a bridge for ADBannerview. Feel free to contribute :-)
Installation
npm install react-native-adbannerview --save
- Xcode: Right click
Libraries
➜Add Files to [project]
- Choose
node_modules/react-native-adbannerview/lib/ADBannerViewManager.xcodeproj
- Xcode: Select the project in the navigator and add the library to the
Build Phases
➜Link Binary With Libraries
(libADBannerViewManager.a
)
See: http://facebook.github.io/react-native/docs/linking-libraries-ios.html#content (Step 1 + 2)
Usage
; ... <ADBannerView />
The bannerview only appears, when an ad has been loaded successfully. Check the example below, where an additional View-Component is used to display the ADBannerView properly.
Props
Event | Description |
---|---|
didFailToReceiveAdWithError | Error loading banner |
willLoadAd | Before a new banner ad is loaded |
didLoadAd | When a new banner ad is loaded |
actionDidFinish | After banner view finishes executing an action |
Example
/** * Sample React Native App * https://github.com/facebook/react-native */; ; { console } { console } { return <View style=stylesstage> <View style=stylescontainer> <Text style=styleswelcome> Welcome to React Native! </Text> <Text style=stylesinstructions> To get started edit indexiosjs </Text> <Text style=stylesinstructions> Press Cmd+R to reload'\n' Cmd+D or shake for dev menu </Text> </View> <ADBannerView didLoadAd=thisdidLoadAd didFailToReceiveAdWithError=thisdidFailToReceiveAdWithError willLoadAd= {}/> </View> ; }; const styles = StyleSheet; AppRegistry;
Run example
- Clone repo
cd example
npm i
- Xcode: hit
build and run