Skip to content

Commit

Permalink
feat(hooks)!: automatically set isLoaded to false (#199)
Browse files Browse the repository at this point in the history
* feat(hooks)!: automatically set isLoaded to false

When ad was opened, automatically set `isLoaded` to false because `show` cannot be called.

BREAKING CHANGE: `isLoaded` becomes false after a fullscreen ad was shown.
  • Loading branch information
jeremyhalin authored Sep 6, 2022
1 parent 8026f65 commit 9d0ecac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/displaying-ads-hook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Return values of the hook are:

| Name | Type | Description |
| :------------- | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------- |
| isLoaded | boolean | Whether the ad is loaded and ready to to be shown to the user. |
| isLoaded | boolean | Whether the ad is loaded and ready to to be shown to the user. Automatically set to false when the ad was shown. |
| isOpened | boolean | Whether the ad is opened. The value is remained `true` even after the ad is closed unless **new ad is requested**. |
| isClosed | boolean | Whether your ad is dismissed. |
| isShowing | boolean | Whether your ad is showing. The value is equal with `isOpened && !isClosed`. |
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFullScreenAd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function useFullScreenAd<
setState({ isOpened: true });
break;
case AdEventType.CLOSED:
setState({ isClosed: true });
setState({ isClosed: true, isLoaded: false });
break;
case AdEventType.CLICKED:
setState({ isClicked: true });
Expand Down

0 comments on commit 9d0ecac

Please sign in to comment.