Skip to content

Commit 44d82af

Browse files
author
Yusinto Ngadiman
committed
Added support for specifying size: compact or normal (default) so recaptcha can fit on mobile devices.
1 parent a461982 commit 44d82af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/recaptcha.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const ReCAPTCHA = React.createClass({
1010
type: PropTypes.oneOf(["image", "audio"]),
1111
tabindex: PropTypes.number,
1212
onExpired: PropTypes.func,
13+
size: PropTypes.oneOf(["compact", "normal"])
1314
},
1415

1516
getInitialState() {
@@ -21,6 +22,7 @@ const ReCAPTCHA = React.createClass({
2122
theme: "light",
2223
type: "image",
2324
tabindex: 0,
25+
size: "normal"
2426
};
2527
},
2628

@@ -55,13 +57,14 @@ const ReCAPTCHA = React.createClass({
5557
type: this.props.type,
5658
tabindex: this.props.tabindex,
5759
"expired-callback": this.handleExpired,
60+
size: this.props.size
5861
});
5962
this.setState({
6063
widgetId: id,
6164
}, cb);
6265
}
6366
},
64-
67+
6568
componentDidMount() {
6669
this.explicitRender();
6770
},
@@ -73,10 +76,10 @@ const ReCAPTCHA = React.createClass({
7376
render() {
7477
// consume properties owned by the reCATPCHA, pass the rest to the div so the user can style it.
7578
/* eslint-disable no-unused-vars */
76-
let { sitekey, onChange, theme, type, tabindex, onExpired, ...childProps } = this.props;
79+
let { sitekey, onChange, theme, type, tabindex, onExpired, size, ...childProps } = this.props;
7780
/* eslint-enable no-unused-vars */
7881
return (
79-
<div {...childProps} ref="captcha" />
82+
<div {...childProps} ref="captcha" />
8083
);
8184
}
8285
});

0 commit comments

Comments
 (0)