Java Script let timerOn = true; function timer(remaining) { var m = Math.floor(remaining / 60); var s = remaining % 60; m = m < 10 ? '0' + m : m; s = s < 10 ? '0' + s : s; document.getElementById('timer').innerHTML = m + ':' + s; remaining -= 1; if(remaining >= 0 && timerOn) { setTimeout(function() { timer(remaining); }, 1000); return; } if(!timerOn) { // Do validate stuff here return; } // Do timeout stuff here alert('Timeout for otp'); } // Then Call the function of Timer // timer(120); HTML <input type="text" name="otp" placeholer="Enter your otp"/> <div>Time left = <span id="timer"></span></div>
Error: [Reanimated] valueUnpacker is not a worklet, js engine: hermes Fixed it with a version downgrade: npm install react-native-reanimated@3.4.2 And editing the babel.config.js file: module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ['react-native-reanimated/plugin'], };
Prevent SweetAlert to be closed on clicking outside the popup window If you are using Sweet Alert 2, you can use this configuration allowOutsideClick: false, To stop closing by escape key use below also: allowEscapeKey: false,
Comments
Post a Comment