Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
fix: support undefined options for hooks
Browse files Browse the repository at this point in the history
After applying useDeepCompareEffect, when options is undefined, it throws error.
To resolve this, added options parameter defaults to {}.
  • Loading branch information
wjaykim committed Nov 24, 2021
1 parent 98e00bd commit 6646bae
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ads/AppOpenAdProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface AppOpenAdProviderProps {

const AppOpenAdProvider = ({
unitId,
options,
options = {},
children,
}: AppOpenAdProviderProps) => {
const [appOpenAd, setAppOpenAd] = useState<AppOpenAd | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useInterstitialAd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useFullScreenAd from './useFullScreenAd';
*/
export default function useInterstitialAd(
unitId: string | null,
options?: FullScreenAdOptions
options: FullScreenAdOptions = {}
): Omit<AdHookReturns, 'reward'> {
const [interstitialAd, setInterstitialAd] = useState<InterstitialAd | null>(
null
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRewardedAd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useFullScreenAd from './useFullScreenAd';
*/
export default function useRewardedAd(
unitId: string | null,
options?: FullScreenAdOptions
options: FullScreenAdOptions = {}
): AdHookReturns {
const [rewardedAd, setRewardedAd] = useState<RewardedAd | null>(null);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRewardedInterstitialAd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import useFullScreenAd from './useFullScreenAd';
*/
export default function useRewardedInterstitialAd(
unitId: string | null,
options?: FullScreenAdOptions
options: FullScreenAdOptions = {}
): AdHookReturns {
const [rewardedInterstitialAd, setRewardedInterstitialAd] =
useState<RewardedInterstitialAd | null>(null);
Expand Down

0 comments on commit 6646bae

Please sign in to comment.