Skip to content

Commit

Permalink
feat: Add the hasBackdrop property (#43)
Browse files Browse the repository at this point in the history
* added hasBackdrop prop

* updated readme, added passiveSitKey condition to not change current behaviour

* updated readme

* updated version

---------

Co-authored-by: ingmartino <emimemos@gmail.com>
  • Loading branch information
emilianodevborn and emimemos authored Sep 21, 2023
1 parent 01de7c7 commit aadd079
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Otherwise, you should pass in the preferred device locale, e.g. fetched from `ge
| style _(inline component only)_ | ViewStyle (see [here](https://reactnative.dev/docs/view-style-props)) | The webview style |
| baseUrl _(modal component only)_ | string | The url domain defined on your hCaptcha. You generally will not need to change this. |
| passiveSiteKey _(modal component only)_ | boolean | Indicates whether the passive mode is enabled; when true, the modal won't be shown at all |
| hasBackdrop _(modal component only)_ | boolean | Defines if the modal backdrop is shown (true by default) |


## Status
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ConfirmHcaptcha extends PureComponent {
assethost,
imghost,
host,
hasBackdrop,
} = this.props;

return (
Expand All @@ -55,7 +56,7 @@ class ConfirmHcaptcha extends PureComponent {
onBackdropPress={() => this.hide('backdrop')}
onBackButtonPress={() => this.hide('back_button')}
isVisible={show}
hasBackdrop={!passiveSiteKey}
hasBackdrop={!passiveSiteKey && hasBackdrop}
coverScreen={!passiveSiteKey}
>
<SafeAreaView style={[styles.wrapper, { backgroundColor }]}>
Expand Down Expand Up @@ -119,6 +120,7 @@ ConfirmHcaptcha.propTypes = {
assethost: PropTypes.string,
imghost: PropTypes.string,
host: PropTypes.string,
hasBackdrop: PropTypes.bool,
};

ConfirmHcaptcha.defaultProps = {
Expand All @@ -136,6 +138,7 @@ ConfirmHcaptcha.defaultProps = {
assethost: undefined,
imghost: undefined,
host: undefined,
hasBackdrop: true,
};

export default ConfirmHcaptcha;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hcaptcha/react-native-hcaptcha",
"version": "1.5.1",
"version": "1.6.0",
"description": "hCaptcha Library for React Native (both Android and iOS)",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit aadd079

Please sign in to comment.