File tree Expand file tree Collapse file tree 1 file changed +6
-23
lines changed
Expand file tree Collapse file tree 1 file changed +6
-23
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments