From afe946fd39f3619be9d722dafbb5de81741b5982 Mon Sep 17 00:00:00 2001 From: Martynas M Date: Sun, 14 Mar 2021 11:18:56 +0200 Subject: [PATCH] Allow custom WebView style (Addresses issue #14) --- README.md | 1 + src/ReCaptchaComponent.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f6bfb4e..34e42f8 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ import ReCaptchaV3 from '@haskkor/react-native-recaptchav3' |**`captchaDomain`**|Your url registered with Google reCAPTCHA|`None`|`true`|`string`| |**`onReceiveToken`**|The callback used to get the captcha token from the component|`None`|`true`|`(captchaToken: string) => void`| |**`siteKey`**|The site key provided by Google reCAPTCHA|`None`|`true`|`string`| +|**`webViewStyle`**|Additional style for the underlying WebView|`None`|`null`|`React.ViewStyle`| ## [Changelog](https://github.com/Haskkor/react-native-recaptchav3/blob/master/CHANGELOG.md) diff --git a/src/ReCaptchaComponent.tsx b/src/ReCaptchaComponent.tsx index dddd8a2..66f3dcc 100644 --- a/src/ReCaptchaComponent.tsx +++ b/src/ReCaptchaComponent.tsx @@ -1,7 +1,7 @@ import {platform} from './constants' import * as React from 'react' -import {View} from 'react-native' +import {View, ViewStyle} from 'react-native' import { WebView } from 'react-native-webview' type IProps = { @@ -9,6 +9,7 @@ type IProps = { onReceiveToken: (captchaToken: string) => void siteKey: string action: string + webViewStyle?: ViewStyle } const patchPostMessageJsCode = `(${String(function () { @@ -64,7 +65,8 @@ class ReCaptchaComponent extends React.PureComponent { }} onMessage={(e: any) => { this.props.onReceiveToken(e.nativeEvent.data) - }}/> + }} + style={this.props.webViewStyle} /> } }