Comments (7)
Unfortunately, this is how Google renders the reCAPTCHA dialog on mobile browsers.
You can try to inject JS to create CSS code inside the webview and force the wanted position, but I can't guarantee that it will work forever.
Example:
<Recaptcha
webViewProps={{
injectedJavaScript: `
// your javascript code here
`
}}
/>
from react-native-recaptcha-that-works.
iam-ben You can also use style
prop to put the challenge inside a safe area using a margin. Example:
const Recaptcha = forwardRef(
({ onSuccess, onExpire }: RecaptchaProps, ref: Ref<RecaptchaRef>) => {
const insets = useSafeAreaInsets();
const styles = useMemo(
() => ({
marginTop: insets.top,
}),
[insets.top]
);
return (
<RNRecaptcha
ref={ref}
lang={"en"}
siteKey={config.RECAPTCHA_SITE_KEY}
baseUrl={config.GRAPHQL_URI}
size={"normal"}
theme={"dark"}
enterprise={true}
action={RecaptchaAction.MobileLogin}
onExpire={onExpire}
onVerify={onSuccess}
style={styles}
/>
);
}
);
from react-native-recaptcha-that-works.
Good option @w1ll-dev.
from react-native-recaptcha-that-works.
Facing same issue but @w1ll-dev top part is not looking blur as in bottom
from react-native-recaptcha-that-works.
@w1ll-dev please check the screenshot it not covering to the whole screen
const insets = useSafeAreaInsets();
const styles = useMemo(
() => ({
marginTop: insets.top,
}),
[insets.top],
);
<SafeAreaView style={{flex: 1, backgroundColor: colors.background}}> <View style={{flex: 1}}> <Recaptcha ref={recaptcha} siteKey="" baseUrl="https://www.google.com/" onVerify={onVerify} onExpire={onExpire} style={styles} /> </View> </SafeAreaView>
from react-native-recaptcha-that-works.
kashee-lv, my approach just fix the status bar cover problem.
from react-native-recaptcha-that-works.
I encountered a similar issue and was able to resolve it with the following approach:
const insets = useSafeAreaInsets();
webViewProps={{
injectedJavaScript: `
const interval = setInterval(() => {
const iFrames = document.querySelectorAll('iframe');
let lastDivWithIFrame = null;
iFrames.forEach((iframe) => {
const parentDiv = iframe.parentElement;
if (parentDiv.tagName.toLowerCase() === 'div') {
const zIndex = window.getComputedStyle(parentDiv).zIndex;
const width = parentDiv.style.width;
if (zIndex === "2000000000" && width.includes('px')) {
lastDivWithIFrame = parentDiv;
}
}
});
if (lastDivWithIFrame) {
lastDivWithIFrame.style.marginTop = "${insets.top}px";
clearInterval(interval);
}
}, 500);
`,
}}
This script continuously checks for <iframe> elements within
This approach resolved the issue in my case. I hope it helps others facing similar challenges.
from react-native-recaptcha-that-works.
Related Issues (20)
- It always shows the challenges when open reCAPthcha. It happens in any situation. HOT 6
- [chore]: turn loading render optionally HOT 4
- In invisible size, custom domain is not working HOT 4
- Unable to close the modal of Recaptcha HOT 2
- I am not getting any response HOT 5
- Remove the loading indicator or activity indicator HOT 1
- Blocking the UI HOT 3
- TurboModuleRegistry.getEnforcing(...): 'RNCWebView' could not be found. Verify that a module by this name is registered in the native binary. HOT 2
- Chrome Certificate Transparency log list v2 turndown HOT 4
- Facing issue inside modals HOT 1
- Encountering 'onError' Triggered Issue with reCAPTCHA: Help Needed! HOT 1
- Support of React Native Web ? HOT 1
- Not working in production HOT 1
- Creating a site key for android and iOS HOT 5
- Image Selection Card White Background HOT 3
- [Android] Failed to call method WebViewMessageHandler1.onMessage() HOT 3
- I can't change the style of the recpatcha widget HOT 6
- Only size="invisible" is working when enterprise is true HOT 5
- reCAPTCHA SDK Update Inquiry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-recaptcha-that-works.