├── android
├── app
│ ├── .gitignore
│ ├── .DS_Store
│ ├── src
│ │ ├── .DS_Store
│ │ └── main
│ │ │ ├── .DS_Store
│ │ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── java
│ │ │ ├── .DS_Store
│ │ │ └── suraj
│ │ │ │ ├── .DS_Store
│ │ │ │ └── tiwari
│ │ │ │ ├── .DS_Store
│ │ │ │ └── reactnativefbads
│ │ │ │ ├── MediaViewManager.java
│ │ │ │ ├── AdIconViewManager.java
│ │ │ │ ├── NativeAdChoicesView.java
│ │ │ │ ├── NativeAdChoicesViewManager.java
│ │ │ │ ├── FBAdsPackage.java
│ │ │ │ ├── BannerViewManager.java
│ │ │ │ ├── NativeAdViewManager.java
│ │ │ │ ├── InterstitialAdManager.java
│ │ │ │ ├── NativeAdView.java
│ │ │ │ ├── BannerView.java
│ │ │ │ ├── AdSettingsManager.java
│ │ │ │ └── NativeAdManager.java
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ └── proguard-rules.pro
├── settings.gradle
├── .DS_Store
├── build
│ └── .DS_Store
├── gradle
│ └── .DS_Store
├── build.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
├── ios
├── .DS_Store
├── ReactNativeAdsFacebook
│ ├── EXBannerViewManager.h
│ ├── EXAdSettingsManager.h
│ ├── EXUnversioned.h
│ ├── EXInterstitialAdManager.h
│ ├── EXNativeMediaViewManager.h
│ ├── EXAdIconViewManager.h
│ ├── EXNativeAdEmitter.h
│ ├── EXAdIconViewManager.m
│ ├── EXNativeAdManager.h
│ ├── EXNativeMediaViewManager.m
│ ├── EXBannerView.h
│ ├── AdChoiceManager.h
│ ├── EXNativeAdEmitter.m
│ ├── AdChoiceView.h
│ ├── EXNativeAdView.h
│ ├── EXBannerViewManager.m
│ ├── AdChoiceManager.m
│ ├── AdChoiceView.m
│ ├── EXNativeAdView.m
│ ├── EXBannerView.m
│ ├── EXInterstitialAdManager.m
│ ├── EXAdSettingsManager.m
│ └── EXNativeAdManager.m
└── ReactNativeAdsFacebook.xcodeproj
│ └── project.pbxproj
├── images
├── nativeAd.png
└── threed_mockup_fbNativeads.png
├── .gitignore
├── InterstitialAdManager.js
├── index.js
├── .github
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── package.json
├── BannerViewManager.js
├── AdIconViewManager.js
├── MediaViewManager.js
├── TriggerableView.js
├── AdSettings.js
├── .npmignore
├── AdChoicesManager.js
├── CODE_OF_CONDUCT.md
├── NativeAdsManager.js
├── withNativeAd.js
├── readme.md
└── LICENCE
/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/ios/.DS_Store
--------------------------------------------------------------------------------
/android/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/.DS_Store
--------------------------------------------------------------------------------
/images/nativeAd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/images/nativeAd.png
--------------------------------------------------------------------------------
/android/app/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/.DS_Store
--------------------------------------------------------------------------------
/android/build/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/build/.DS_Store
--------------------------------------------------------------------------------
/android/gradle/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/gradle/.DS_Store
--------------------------------------------------------------------------------
/android/app/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/.DS_Store
--------------------------------------------------------------------------------
/android/app/src/main/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/.DS_Store
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ReactNativeFbAds
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/java/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/java/.DS_Store
--------------------------------------------------------------------------------
/images/threed_mockup_fbNativeads.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/images/threed_mockup_fbNativeads.png
--------------------------------------------------------------------------------
/android/app/src/main/java/suraj/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/java/suraj/.DS_Store
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXBannerViewManager.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface EXBannerViewManager : RCTViewManager
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/android/app/src/main/java/suraj/tiwari/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/java/suraj/tiwari/.DS_Store
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXAdSettingsManager.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface EXAdSettingsManager : NSObject
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXUnversioned.h:
--------------------------------------------------------------------------------
1 | @import Foundation;
2 |
3 | #define EX_UNVERSIONED(symbol) symbol
4 |
5 | @protocol EXUnversioned
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXInterstitialAdManager.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface EXInterstitialAdManager : NSObject
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suraj-Tiwari/react-native-ads-facebook/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Example user template template
3 | ### Example user template
4 |
5 | # IntelliJ project files
6 | .idea
7 | *.iml
8 | out
9 | gen
10 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeMediaViewManager.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | @import FBAudienceNetwork;
4 |
5 | @interface EXNativeMediaViewManager : RCTViewManager
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXAdIconViewManager.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 |
5 | @interface EXAdIconViewManager : RCTViewManager
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeAdEmitter.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface EXNativeAdEmitter : RCTEventEmitter
4 |
5 | - (void)sendManagersState:(NSDictionary *)adManagersState;
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXAdIconViewManager.m:
--------------------------------------------------------------------------------
1 | #import "EXAdIconViewManager.h"
2 |
3 | @implementation EXAdIconViewManager
4 |
5 | RCT_EXPORT_MODULE(AdIconViewManager)
6 |
7 | - (UIView *)view
8 | {
9 | return [[FBAdIconView alloc] init];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeAdManager.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface EXNativeAdManager : RCTViewManager
5 |
6 | - (FBNativeAdsManager *) getFBAdsManager:(NSString *)placementId;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeMediaViewManager.m:
--------------------------------------------------------------------------------
1 | #import "EXNativeMediaViewManager.h"
2 |
3 | @implementation EXNativeMediaViewManager
4 |
5 | RCT_EXPORT_MODULE(MediaViewManager)
6 |
7 | - (UIView *)view
8 | {
9 | return [[FBMediaView alloc] init];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/InterstitialAdManager.js:
--------------------------------------------------------------------------------
1 | import { NativeModules } from 'react-native';
2 |
3 | const { CTKInterstitialAdManager } = NativeModules;
4 |
5 | export default {
6 | /**
7 | * Shows interstitial ad for a given placementId
8 | */
9 | showAd(placementId: string): Promise {
10 | return CTKInterstitialAdManager.showAd(placementId);
11 | },
12 | };
13 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXBannerView.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface EXBannerView : RCTView
5 |
6 | @property (nonatomic, copy) RCTBubblingEventBlock onAdPress;
7 | @property (nonatomic, copy) RCTBubblingEventBlock onAdError;
8 |
9 | @property (nonatomic, strong) NSNumber *size;
10 | @property (nonatomic, strong) NSString *placementId;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/AdChoiceManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // AdChoiceManager.h
3 | // ReactNativeAdsFacebook
4 | //
5 | // Created by Suraj Tiwari on 14/08/18.
6 | // Copyright © 2018 Suraj Tiwari . All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface AdChoiceManager : RCTViewManager
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeAdEmitter.m:
--------------------------------------------------------------------------------
1 | #import "EXNativeAdEmitter.h"
2 |
3 | @implementation EXNativeAdEmitter
4 |
5 | RCT_EXPORT_MODULE(CTKNativeAdEmitter)
6 |
7 | - (NSArray *)supportedEvents
8 | {
9 | return @[@"CTKNativeAdsManagersChanged"];
10 | }
11 |
12 | - (void)sendManagersState:(NSDictionary *)adManagersState {
13 | [self sendEventWithName:@"CTKNativeAdsManagersChanged" body:adManagersState];
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | // google()
4 | jcenter()
5 | maven { url 'https://maven.google.com' }
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.0.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | jcenter()
15 | maven { url 'https://maven.google.com' }
16 | }
17 | }
18 |
19 | task clean(type: Delete) {
20 | delete rootProject.buildDir
21 | }
22 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | export { default as withNativeAd } from './withNativeAd';
2 | export { default as AdSettings } from './AdSettings';
3 | export { default as NativeAdsManager } from './NativeAdsManager';
4 | export { default as InterstitialAdManager } from './InterstitialAdManager';
5 | export { default as BannerView } from './BannerViewManager';
6 | export { default as MediaView } from './MediaViewManager';
7 | export { default as AdIconView } from './AdIconViewManager';
8 | export { default as TriggerableView } from './TriggerableView';
9 | export { default as AdChoicesView } from './AdChoicesManager';
10 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/AdChoiceView.h:
--------------------------------------------------------------------------------
1 | //
2 | // AdChoiceView.h
3 | // ReactNativeAdsFacebook
4 | //
5 | // Created by Suraj Tiwari on 14/08/18.
6 | // Copyright © 2018 Suraj Tiwari . All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | @interface AdChoiceView : RCTView
15 |
16 | @property (nonatomic, strong) NSString *placementId;
17 | @property (nonatomic) UIRectCorner *location;
18 | @property (nonatomic) BOOL *expandable;
19 |
20 | - (instancetype)initWithBridge:(RCTBridge *)bridge;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/android/app/src/main/java/suraj/tiwari/reactnativefbads/MediaViewManager.java:
--------------------------------------------------------------------------------
1 | package suraj.tiwari.reactnativefbads;
2 |
3 | import com.facebook.ads.MediaView;
4 | import com.facebook.react.uimanager.SimpleViewManager;
5 | import com.facebook.react.uimanager.ThemedReactContext;
6 |
7 | public class MediaViewManager extends SimpleViewManager {
8 | private static final String REACT_CLASS = "MediaView";
9 |
10 | @Override
11 | public String getName() {
12 | return REACT_CLASS;
13 | }
14 |
15 | @Override
16 | protected MediaView createViewInstance(ThemedReactContext reactContext) {
17 | return new MediaView(reactContext);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android/app/src/main/java/suraj/tiwari/reactnativefbads/AdIconViewManager.java:
--------------------------------------------------------------------------------
1 | package suraj.tiwari.reactnativefbads;
2 |
3 | import com.facebook.ads.AdIconView;
4 | import com.facebook.react.uimanager.SimpleViewManager;
5 | import com.facebook.react.uimanager.ThemedReactContext;
6 |
7 | public class AdIconViewManager extends SimpleViewManager {
8 | private static final String REACT_CLASS = "AdIconView";
9 |
10 | @Override
11 | public String getName() {
12 | return REACT_CLASS;
13 | }
14 |
15 | @Override
16 | protected AdIconView createViewInstance(ThemedReactContext reactContext) {
17 | return new AdIconView(reactContext);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXNativeAdView.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 | #import
5 |
6 | @interface EXNativeAdView : RCTView
7 |
8 | // `onAdLoaded` event called when ad has been loaded
9 | @property (nonatomic, copy) RCTBubblingEventBlock onAdLoaded;
10 |
11 | // NativeAd this view has been loaded with
12 | @property (nonatomic, strong) FBNativeAd *nativeAd;
13 |
14 | - (instancetype)initWithBridge:(RCTBridge *)bridge;
15 | - (void)registerViewsForInteraction:(FBMediaView *)mediaView adIcon:(FBAdIconView *)adIconView clickableViews:(NSArray *)clickable;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | ndk {
13 | abiFilters "armeabi-v7a", "x86"
14 | }
15 | }
16 | }
17 |
18 | repositories {
19 | jcenter()
20 | maven { url 'https://maven.google.com' }
21 | }
22 |
23 | dependencies {
24 | compile 'com.facebook.react:react-native:+'
25 | compile 'com.android.support:appcompat-v7:26.1.0'
26 | compile 'com.facebook.android:audience-network-sdk:4.99.1'
27 | }
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "license": "GNU General Public License v3.0",
3 | "main": "index.js",
4 | "name": "react-native-ads-facebook",
5 | "author": "Suraj Tiwari ",
6 | "description": "Facebooks Audience network ads library",
7 | "repository": {
8 | "type": "git",
9 | "url": "https://github.com/Suraj-Tiwari/react-native-ads-facebook.git"
10 | },
11 | "keywords": [
12 | "react-native",
13 | "facebook",
14 | "Audience Network",
15 | "Native ads"
16 | ],
17 | "version": "0.2.0",
18 | "rnpm": {
19 | "android": {
20 | "sourceDir": "android/app"
21 | }
22 | },
23 | "dependencies": {
24 | "fbemitter": "^2.1.1"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ios/ReactNativeAdsFacebook/EXBannerViewManager.m:
--------------------------------------------------------------------------------
1 | #import "EXBannerViewManager.h"
2 | #import "EXBannerView.h"
3 |
4 | @implementation EXBannerViewManager
5 |
6 | RCT_EXPORT_MODULE(CTKBannerViewManager)
7 |
8 | @synthesize bridge = _bridge;
9 |
10 | - (UIView *)view
11 | {
12 | // if (![EXFacebook facebookAppIdFromNSBundle]) {
13 | // RCTLogWarn(@"No Facebook app id is specified. Facebook ads may have undefined behavior.");
14 | // }
15 | return [EXBannerView new];
16 | }
17 |
18 | RCT_EXPORT_VIEW_PROPERTY(size, NSNumber)
19 | RCT_EXPORT_VIEW_PROPERTY(placementId, NSString)
20 | RCT_EXPORT_VIEW_PROPERTY(onAdPress, RCTBubblingEventBlock)
21 | RCT_EXPORT_VIEW_PROPERTY(onAdError, RCTBubblingEventBlock)
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 | android.useDeprecatedNdk=true
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 |
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 | Steps to reproduce the behavior:
12 | 1. Go to '...'
13 | 2. Click on '....'
14 | 3. Scroll down to '....'
15 | 4. See error
16 |
17 | **Expected behavior**
18 | A clear and concise description of what you expected to happen.
19 |
20 | **Screenshots**
21 | If applicable, add screenshots to help explain your problem.
22 |
23 | **Desktop (please complete the following information):**
24 | - OS: [e.g. iOS]
25 | - Browser [e.g. chrome, safari]
26 | - Version [e.g. 22]
27 |
28 | **Smartphone (please complete the following information):**
29 | - Device: [e.g. iPhone6]
30 | - OS: [e.g. iOS8.1]
31 | - Browser [e.g. stock browser, safari]
32 | - Version [e.g. 22]
33 |
34 | **Additional context**
35 | Add any other context about the problem here.
36 |
--------------------------------------------------------------------------------
/android/app/src/main/java/suraj/tiwari/reactnativefbads/NativeAdChoicesView.java:
--------------------------------------------------------------------------------
1 | /**
2 | * NativeAdChoicesView.java
3 | * suraj.tiwari.reactnativefbads
4 | *
5 | * Created by Suraj Tiwari on 07/08/18.
6 | * Copyright © 2018 Suraj Tiwari All rights reserved.
7 | */
8 | package suraj.tiwari.reactnativefbads;
9 |
10 | import com.facebook.ads.NativeAd;
11 | import com.facebook.ads.AdChoicesView;
12 | import com.facebook.react.bridge.ReactContext;
13 | import com.facebook.react.uimanager.ThemedReactContext;
14 | import com.facebook.react.views.view.ReactViewGroup;
15 |
16 | public class NativeAdChoicesView extends ReactViewGroup {
17 |
18 | private ReactContext mContext;
19 | public NativeAdChoicesView(ThemedReactContext context) {
20 | super(context);
21 | mContext = context;
22 | }
23 |
24 | public void setNativeAd(NativeAd nativeAd) {
25 | AdChoicesView adChoicesView = new AdChoicesView(mContext, nativeAd, true);
26 | adChoicesView.measure(40, 40);
27 | adChoicesView.layout(0, 0, 40, 40);
28 | adChoicesView.bringToFront();
29 | addView(adChoicesView);
30 | }
31 | }
--------------------------------------------------------------------------------
/BannerViewManager.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { requireNativeComponent } from 'react-native';
3 |
4 | type AdType = 'large' | 'rectangle' | 'standard';
5 |
6 | const CTKBannerView = requireNativeComponent('CTKBannerView', null, {
7 | onAdPress: true,
8 | onAdError: true,
9 | });
10 |
11 | const sizeForType = {
12 | large: 90,
13 | rectangle: 250,
14 | standard: 50,
15 | };
16 |
17 | /**
18 | * Gets size for a type (any value of `AdType` is allowed)
19 | */
20 | const getSizeForType = (type: AdType) => sizeForType[type] || sizeForType.standard;
21 |
22 | type BannerViewProps = {
23 | type: AdType,
24 | placementId: string,
25 | onPress: Function,
26 | onError: Function,
27 | style: any,
28 | };
29 |
30 | const BannerView = (props: BannerViewProps) => {
31 | const { type, onPress, onError, style, ...restProps } = props;
32 | const size = getSizeForType(type);
33 |
34 | return (
35 |
42 | );
43 | };
44 |
45 | export default BannerView;
46 |
--------------------------------------------------------------------------------
/AdIconViewManager.js:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import {requireNativeComponent} from 'react-native';
3 |
4 | import {AdIconViewContext} from './withNativeAd';
5 | import type {AdIconViewContextValueType} from './withNativeAd';
6 |
7 | export const NativeAdIconView = requireNativeComponent('AdIconView', null, {});
8 |
9 | class AdIconViewChild extends React.Component {
10 | _iconView: ?React.Node;
11 |
12 | _handleAdIconViewRef = (ref: ?React.Node) => {
13 | if (this._iconView) {
14 | this.props.unregister(this._iconView);
15 | this._iconView = null;
16 | }
17 |
18 | if (ref) {
19 | this.props.register(ref);
20 | this._iconView = ref;
21 | }
22 | };
23 |
24 | render() {
25 | return ;
26 | }
27 | }
28 |
29 | export default class AdIconView extends React.Component