File tree Expand file tree Collapse file tree 5 files changed +19
-24
lines changed Expand file tree Collapse file tree 5 files changed +19
-24
lines changed Original file line number Diff line number Diff line change 99} from 'react-native' ;
1010import { string , func , arrayOf } from 'prop-types' ;
1111
12+ import { createErrorFromErrorData } from './utils' ;
13+
1214class AdMobBanner extends Component {
1315
1416 constructor ( ) {
@@ -42,7 +44,7 @@ class AdMobBanner extends Component {
4244
4345 handleDidFailToReceiveAdWithError ( event ) {
4446 if ( this . props . onDidFailToReceiveAdWithError ) {
45- this . props . onDidFailToReceiveAdWithError ( event . nativeEvent . error ) ;
47+ this . props . onDidFailToReceiveAdWithError ( createErrorFromErrorData ( event . nativeEvent . error ) ) ;
4648 }
4749 }
4850
Original file line number Diff line number Diff line change @@ -3,22 +3,14 @@ import {
33 NativeEventEmitter ,
44} from 'react-native' ;
55
6+ import { createErrorFromErrorData } from './utils' ;
7+
68const RNAdMobInterstitial = NativeModules . RNAdMobInterstitial ;
79
810const adMobInterstitialEmitter = new NativeEventEmitter ( RNAdMobInterstitial ) ;
911
1012const eventHandlers = { } ;
1113
12- const createErrorFromErrorData = ( errorData ) => {
13- const {
14- message,
15- ...extraErrorInfo
16- } = errorData || { } ;
17- const error = new Error ( message ) ;
18- error . framesToPop = 1 ;
19- return Object . assign ( error , extraErrorInfo ) ;
20- }
21-
2214const addEventListener = ( type , handler ) => {
2315 eventHandlers [ type ] = eventHandlers [ type ] || new Map ( ) ;
2416 if ( type === 'interstitialDidFailToLoad' ) {
Original file line number Diff line number Diff line change 11import {
2- Platform ,
32 NativeModules ,
43 NativeEventEmitter ,
54} from 'react-native' ;
65
6+ import { createErrorFromErrorData } from './utils' ;
7+
78const RNAdMobRewarded = NativeModules . RNAdMobRewarded ;
89
910const adMobRewardedEmitter = new NativeEventEmitter ( RNAdMobRewarded ) ;
1011
1112const eventHandlers = { } ;
1213
13- const createErrorFromErrorData = ( errorData ) => {
14- const {
15- message,
16- ...extraErrorInfo
17- } = errorData || { } ;
18- const error = new Error ( message ) ;
19- error . framesToPop = 1 ;
20- return Object . assign ( error , extraErrorInfo ) ;
21- }
22-
2314const addEventListener = ( type , handler ) => {
2415 eventHandlers [ type ] = eventHandlers [ type ] || new Map ( ) ;
2516 if ( type === 'rewardedVideoDidFailToLoad' ) {
@@ -52,5 +43,4 @@ export default {
5243 addEventListener,
5344 removeEventListener,
5445 removeAllListeners,
55- simulatorId : Platform . OS === 'android' ? 'EMULATOR' : RNAdMobRewarded . simulatorId ,
5646} ;
Original file line number Diff line number Diff line change 99} from 'react-native' ;
1010import { string , func , arrayOf } from 'prop-types' ;
1111
12+ import { createErrorFromErrorData } from './utils' ;
13+
1214class PublisherBanner extends Component {
1315
1416 constructor ( ) {
@@ -50,7 +52,7 @@ class PublisherBanner extends Component {
5052
5153 handleDidFailToReceiveAdWithError ( event ) {
5254 if ( this . props . onDidFailToReceiveAdWithError ) {
53- this . props . onDidFailToReceiveAdWithError ( event . nativeEvent . error ) ;
55+ this . props . onDidFailToReceiveAdWithError ( createErrorFromErrorData ( event . nativeEvent . error ) ) ;
5456 }
5557 }
5658
Original file line number Diff line number Diff line change 1+ export const createErrorFromErrorData = ( errorData ) => {
2+ const {
3+ message,
4+ ...extraErrorInfo
5+ } = errorData || { } ;
6+ const error = new Error ( message ) ;
7+ error . framesToPop = 1 ;
8+ return Object . assign ( error , extraErrorInfo ) ;
9+ }
You can’t perform that action at this time.
0 commit comments