Skip to content

Commit

Permalink
react-native 0.74 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
srfaytkn committed May 15, 2024
1 parent c5ea435 commit 25c12de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@charmy.tech/react-native-admost",
"version": "3.2.1",
"version": "3.2.2",
"description": "AdMost react-native implementation",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
18 changes: 12 additions & 6 deletions src/AdMostAdView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ function AdMostAdView({
}, []);

const loadAd = useCallback(() => {
// @ts-ignore
const commandId = Platform.OS === "ios" ? UIManager[RCTComponentName].Commands.loadAd : "loadAd";
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
const commandId =
Platform.OS === "ios" ? UIManager.getViewManagerConfig(RCTComponentName).Commands.loadAd : "loadAd";

if (commandId) {
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
}
}, [rctAdMostAdViewRef.current]);

const destroyAd = useCallback(() => {
// @ts-ignore
const commandId = Platform.OS === "ios" ? UIManager[RCTComponentName].Commands.destroyAd : "destroyAd";
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
const commandId =
Platform.OS === "ios" ? UIManager.getViewManagerConfig(RCTComponentName).Commands.destroyAd : "destroyAd";

if (commandId) {
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
}
}, [rctAdMostAdViewRef.current]);

return (
Expand Down

0 comments on commit 25c12de

Please sign in to comment.