Skip to content

Commit b3fdd5b

Browse files
authored
Merge pull request dozoisch#196 from dozoisch/fix-171-timeout
Remove timeout removal, remove component unmount
2 parents ed4e6a7 + 945ddec commit b3fdd5b

File tree

4 files changed

+17
-25
lines changed

4 files changed

+17
-25
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
v3.0.0-alpha.1 - Mon 23 Nov 2020 22:25 ET
2+
---------------------------------------
3+
- Add isolated prop [(#179)](https://github.com/dozoisch/react-google-recaptcha/issues/179)
4+
- Update dependencies 1 [(#187)](https://github.com/dozoisch/react-google-recaptcha/issues/187)
5+
- Update dependencies 2 [(#194)](https://github.com/dozoisch/react-google-recaptcha/issues/194)
6+
- Remove Timeout Removal [(#196)](https://github.com/dozoisch/react-google-recaptcha/issues/196)
7+
8+
9+
110
v2.1.0 - Fri 5 Jun 2020 22:05 PST
211
---------------------------------------
312
- Add promise based Execution [(#163)](https://github.com/dozoisch/react-google-recaptcha/issues/163)

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-google-recaptcha",
3-
"version": "2.1.0",
3+
"version": "3.0.0-alpha.1",
44
"description": "React Component Wrapper for Google reCAPTCHA",
55
"main": "lib/index.js",
66
"module": "lib/esm/index.js",

src/recaptcha.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export default class ReCAPTCHA extends React.Component {
4848
}
4949
}
5050

51+
forceReset() {
52+
if (this.props.grecaptcha) {
53+
this.props.grecaptcha.reset();
54+
}
55+
}
56+
5157
handleExpired() {
5258
if (this.props.onExpired) {
5359
this.props.onExpired();
@@ -111,29 +117,6 @@ export default class ReCAPTCHA extends React.Component {
111117
this.explicitRender();
112118
}
113119

114-
componentWillUnmount() {
115-
if (this._widgetId !== undefined) {
116-
this.delayOfCaptchaIframeRemoving();
117-
this.reset();
118-
}
119-
}
120-
121-
delayOfCaptchaIframeRemoving() {
122-
const temporaryNode = document.createElement("div");
123-
document.body.appendChild(temporaryNode);
124-
temporaryNode.style.display = "none";
125-
126-
// move of the recaptcha to a temporary node
127-
while (this.captcha.firstChild) {
128-
temporaryNode.appendChild(this.captcha.firstChild);
129-
}
130-
131-
// delete the temporary node after reset will be done
132-
setTimeout(() => {
133-
document.body.removeChild(temporaryNode);
134-
}, 5000);
135-
}
136-
137120
handleRecaptchaRef(elem) {
138121
this.captcha = elem;
139122
}

0 commit comments

Comments
 (0)