Skip to content

Commit

Permalink
fix: typo in native event type
Browse files Browse the repository at this point in the history
  • Loading branch information
dylancom committed Jan 24, 2022
1 parent e39a5fd commit 3cfc1ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ads/BannerAd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { RequestOptions } from '../types/RequestOptions';

type NativeEvent =
| {
type: 'onAdLoaded' | 'onSizeChanged';
type: 'onAdLoaded' | 'onSizeChange';
width: number;
height: number;
}
Expand Down Expand Up @@ -78,15 +78,15 @@ export function BannerAd({ unitId, size, requestOptions, ...props }: BannerAdPro
function onNativeEvent({ nativeEvent }: { nativeEvent: NativeEvent }) {
const { type } = nativeEvent;

if (type !== 'onSizeChanged' && isFunction(props[type])) {
if (type !== 'onSizeChange' && isFunction(props[type])) {
let eventHandler;
if (type === 'onAdFailedToLoad') {
const eventPayload = NativeError.fromEvent(nativeEvent, 'googleAds');
if ((eventHandler = props[type])) eventHandler(eventPayload);
} else if ((eventHandler = props[type])) eventHandler();
}

if ((type === 'onAdLoaded' || type === 'onSizeChanged') && size !== 'FLUID') {
if ((type === 'onAdLoaded' || type === 'onSizeChange') && size !== 'FLUID') {
const { width, height } = nativeEvent;
if (width && height) setDimensions([width, height]);
}
Expand Down

0 comments on commit 3cfc1ff

Please sign in to comment.