-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MediaView and CallToActionView are not clickable #57
Comments
Can you test this in the example app provided in the project? The views are clickable, also mention your react-native version. |
@ammarahm-ed I've also noticed that Using React native 0.63.2, so the new Pressability API, but that shouldn't matter since clicks are handled natively through the Text component, right? |
Try to use Buttons etc are not clickable only when they are not registered on the Native code. Its not related to Pressability API. |
Hi @ammarahm-ed, thanks so much for your work. |
I've tried to build the Example and it's fine...
if you have any idea ... thanks ! |
On CallToActionView.js, replacing RawButton and GestureHandlerRootView by View made it work on iOS but not on Android. |
Hi, @ammarahm-ed thanks for the great package. Is there a way to make only the CallToActionView clickable? As according to the Google policies:
https://support.google.com/admob/answer/6329638?ref_topic=7384666 |
Fixed a couple of mistakes in the original implementation. Don't have enough time for proper PR at the moment, but here is what worked out for me: import React, {useCallback, useContext, useEffect, useRef} from 'react';
import {findNodeHandle, Text} from 'react-native';
import {RawButton, GestureHandlerRootView} from 'react-native-gesture-handler';
import {NativeAdContext} from 'react-native-admob-native-ads/src/context';
export default function CallToActionView(props) {
const {nativeAd, nativeAdView} = useContext(NativeAdContext);
const callToActionRef = useRef();
const _onLayout = useCallback(() => {
if (!nativeAdView) {
return;
}
nativeAdView.setNativeProps({
callToAction: findNodeHandle(callToActionRef.current),
});
}, [nativeAdView]);
useEffect(() => {
_onLayout();
}, [_onLayout]);
return (
<GestureHandlerRootView>
<RawButton
ref={callToActionRef}
onLayout={_onLayout}
style={[props.style]}>
<Text
allowFontScaling={
props.allowFontScaling ? props.allowFontScaling : false
}
style={[props.textStyle]}>
{nativeAd
? props.allCaps
? nativeAd.callToAction?.toUpperCase()
: nativeAd.callToAction
: null}
</Text>
</RawButton>
</GestureHandlerRootView>
);
} Main things to notice:
|
@sslava I have added these changes, I will test this out before next release |
Using V0.6.6 and having multiple ads in a Flatlist (using pre-loading ads option), some ads are not clickable. Running debug using XCode, I got this error showing: |
Mmmmh, any update on this one? Facing the same problem :( |
Hello!
Thank you for the awesome package.
It works but in my case, MediaView and CallToActionView are not clickable.
I've copied a sample code but there is no action when I click on the image or action button.
Have I missed something or this is the bug?
Thank you!
--
Regards, Dmitry
The text was updated successfully, but these errors were encountered: