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 25c12de commit 1894255
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 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.2",
"version": "3.2.3",
"description": "AdMost react-native implementation",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
10 changes: 6 additions & 4 deletions src/AdMostAdView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ function AdMostAdView({
}, []);

const loadAd = useCallback(() => {
const viewId = findNodeHandle(rctAdMostAdViewRef.current);
const commandId =
Platform.OS === "ios" ? UIManager.getViewManagerConfig(RCTComponentName).Commands.loadAd : "loadAd";

if (commandId) {
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
if (commandId !== undefined && viewId !== null) {
UIManager.dispatchViewManagerCommand(viewId, commandId, []);
}
}, [rctAdMostAdViewRef.current]);

const destroyAd = useCallback(() => {
const viewId = findNodeHandle(rctAdMostAdViewRef.current);
const commandId =
Platform.OS === "ios" ? UIManager.getViewManagerConfig(RCTComponentName).Commands.destroyAd : "destroyAd";

if (commandId) {
UIManager.dispatchViewManagerCommand(findNodeHandle(rctAdMostAdViewRef.current), commandId, []);
if (commandId !== undefined && viewId !== null) {
UIManager.dispatchViewManagerCommand(viewId, commandId, []);
}
}, [rctAdMostAdViewRef.current]);

Expand Down

0 comments on commit 1894255

Please sign in to comment.