Skip to content

Commit

Permalink
Allow custom WebView style (Addresses issue jarden-digital#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Invertisment committed Mar 14, 2021
1 parent fd7461f commit afe946f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions src/ReCaptchaComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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 = {
captchaDomain: string
onReceiveToken: (captchaToken: string) => void
siteKey: string
action: string
webViewStyle?: ViewStyle
}

const patchPostMessageJsCode = `(${String(function () {
Expand Down Expand Up @@ -64,7 +65,8 @@ class ReCaptchaComponent extends React.PureComponent<IProps> {
}}
onMessage={(e: any) => {
this.props.onReceiveToken(e.nativeEvent.data)
}}/>
}}
style={this.props.webViewStyle} />
</View>
}
}
Expand Down

0 comments on commit afe946f

Please sign in to comment.