react-native-teads
Getting started
$ npm install react-native-teads --save
Mostly automatic installation
$ react-native link react-native-teads
NOTE:
Android:
You need to add maven { url "http://dl.bintray.com/teads/TeadsSDK-android" }
to your android/build.gradle as follows:
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-teads
and addRNTeads.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNTeads.a
to your project'sBuild Phases
➜Link Binary With Libraries
- link the
TeadsSDK.framework
to your project by drag and drop and make sureTeadsSDK.framework
appears in application's target > General > Linked Framework and Libraries - Add
TeadsSDK.framework
to application target > General > Embedded Binaries - Run your project (
Cmd+R
)
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.TeadsPackage;
to the imports at the top of the file - Add
new TeadsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-teads' project(':react-native-teads').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-teads/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-teads')
- You need to add
maven { url "http://dl.bintray.com/teads/TeadsSDK-android" }
to your android/build.gradle as follows:allprojects { repositories { // ... maven { url 'http://dl.bintray.com/teads/TeadsSDK-android' } } // ... }
Usage
Ad view usage
;;; const width = Dimensions; <Props State> { superprops; thisstate = height: 0 ; } { this; }; { const style = thisprops; return <TeadsNativeAdView style= width height: thisstateheight style pid=84242 onDidReceiveAd=thisonDidReceiveAd /> ; }