[RewardAd] Server side validation doesn't work
nmluancs opened this issue · comments
Description
I use useRewardedAd to load a rewrading video. In the request, i use requestOptions but it is disabled before sending to native.
Snack or minimal code example
Here is the example code:
const { adLoaded, reward, adPresented, show } = useRewardedAd(
rewardedUnitId,
{
loadOnDismissed: true,
requestOptions: {
serverSideVerificationOptions: {
userId: userId,
customData: userId
}
}
}
);
After reading code, i found the problem:
It is line 128 of https://github.com/react-native-admob/admob/blob/master/src/ads/fullscreen/FullScreenAd.ts
const options = {
...this.options,
...({
requestOptions,
} as FullScreenAdOptions | AppOpenAdOptions),
};
requestOptions's default value is {} then it will always reset the requestOptions
It can be fixed as :
const options = JSON.stringify(requestOptions) == '{}' ? this.options : {
...this.options,
...({
requestOptions,
} as FullScreenAdOptions | AppOpenAdOptions),
};
Package versions
- React Native AdMob: 2.0.0
Affected platforms
- Android
- iOS
This library is deprecated. Use react-native-google-mobile-ads instead.
Please migrate to the new library if you were using this library as this library is no longer maintained. Now more stronger features are available in the new library.