react-otpcode-input
Advanced tools
Comparing version 0.1.33 to 0.1.34
11
index.js
@@ -97,4 +97,2 @@ "use strict"; | ||
console.log(value); | ||
var handleKeyDown = function handleKeyDown(e) { | ||
@@ -112,4 +110,3 @@ if (e.keyCode === 8) { | ||
if (key === "backSpaceKey" && active !== 0) { | ||
setActive(active - 1); // setOtpValues(otpValues.slice(0, otpValues.length - 1)); | ||
setActive(active - 1); | ||
setOtpValues(otpValues.slice(0, otpValues.length - 1)); | ||
@@ -120,4 +117,3 @@ onChange(otpValues); | ||
if (!isNumber(key)) return;else { | ||
setActive(active + 1); // setOtpValues(otpValues.concat(key)); | ||
setActive(active + 1); | ||
setOtpValues(otpValues + key); | ||
@@ -135,2 +131,5 @@ onChange(otpValues); | ||
(0, _react.useEffect)(function () { | ||
console.log(value); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [value]); | ||
(0, _react.useEffect)(function () { | ||
var box = document.getElementById("contentEditableBox"); | ||
@@ -137,0 +136,0 @@ box.addEventListener("keydown", handleKeyDown); |
@@ -53,4 +53,2 @@ import React, { useState, useEffect } from "react"; | ||
console.log(value); | ||
const handleKeyDown = e => { | ||
@@ -70,3 +68,2 @@ if (e.keyCode === 8) { | ||
setActive(active - 1); | ||
// setOtpValues(otpValues.slice(0, otpValues.length - 1)); | ||
setOtpValues(otpValues.slice(0, otpValues.length - 1)); | ||
@@ -79,3 +76,2 @@ onChange(otpValues); | ||
setActive(active + 1); | ||
// setOtpValues(otpValues.concat(key)); | ||
setOtpValues(otpValues + key); | ||
@@ -94,2 +90,8 @@ onChange(otpValues); | ||
useEffect(() => { | ||
console.log(value); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [value]); | ||
useEffect(() => { | ||
const box = document.getElementById("contentEditableBox"); | ||
@@ -96,0 +98,0 @@ box.addEventListener("keydown", handleKeyDown); |
{ | ||
"name": "react-otpcode-input", | ||
"version": "0.1.33", | ||
"version": "0.1.34", | ||
"description": "OTP Input Component", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240
13148