Coder Social home page Coder Social logo

edwardfxiao / react-codes-input Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 1 MB

A react component for PIN, verify code and passcode entering.

Home Page: https://edwardfxiao.github.io/react-codes-input/

License: MIT License

JavaScript 34.94% CSS 8.40% HTML 1.48% TypeScript 55.18%

react-codes-input's People

Contributors

allcontributors[bot] avatar bulhiczar avatar edwardfxiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-codes-input's Issues

Shift key enabled?

I understand that the input field itself already auto uppercase (using props upper),
but how to enable shift key while user input the value?

current behavior shows nothing change when user hold shift while entering the value.
if it is not possible, is there any event listener such as key down or key up that I could override?

add @types fro TS

the best thing is
that there is no girlfriend TS, I can't take to my project(

ReferenceError: navigator is not defined

Hi,
I keep seeing this error on any page I include ReactCodesInput element
I have react ^18.2, react-dom ^18.2 and react-codes-input ^2.1.5

I just return this in my component :
<ReactCodesInput initialFocus={false} codeLength={4} type="alphanumeric" hide={false} placeholder="#" />
and it causes the error:
Screenshot 2022-07-01 at 14 27 38

I am using SSR

bug with type = number

when you do not enter a number, the value disappears, but is written to the store, and if you erase the value, then when the numbers remain, then everything works correctly

start typing numbers first, then letters, an error will appear

focus on Safari

Hi team,

I am struggling with one more issue.
I have multiple (two) ReactCodesInput components on the page and for some reason on Safari browser it focuses in the second one. I was trying to overwrite this behaviour specifying initialFocus={true}and {false} for the first and second one respectively and also by setting focus in the code on the created reference
pinWrapperRef1.current.firstChild.focus();
None of these helped.

I attach the code snippet with the component usage here:

`
<ReactCodesInput
initialFocus={true}
wrapperRef={$pinWrapperRef1}
id="tv-login-code1"
codeLength={4}
type="number"
hide={false}
placeholder="####"
value={pin1}
onChange={(res) => {
setPin1(res);
}}
classNameWrapper={styles.codeInputWrapper}
classNameEnteredValue={styles.codeEnteredValue}
customStyleComponent={{
marginRight: "2%",
width: "48%",
display: "inline-block",
}}
/>

        <ReactCodesInput
          initialFocus={false}
          wrapperRef={$pinWrapperRef2}
          id="tv-login-code2"
          codeLength={4}
          type="number"
          hide={false}
          placeholder="####"
          value={pin2}
          onChange={(res) => {
            setPin2(res);
          }}
          classNameWrapper={styles.codeInputWrapper}
          classNameEnteredValue={styles.codeEnteredValue}
          customStyleComponent={{
            marginLeft: "2%",
            width: "48%",
            display: "inline-block",
          }}
        />`

Could you take a look, please ?

Screenshot 2022-10-04 at 15 55 22

set Initial state for code input

Hi
I am trying to set an initial state to the code input to a value from query parameters, but the submit button doesn't work in this case, even though I am able to see it properly typed in the field, the value is not bounded to the field.
Is there any work around for this ?

const [password, setPassword] = useState("xxxxxx");

<ReactCodesInput initialFocus={true} wrapperRef={$passwordWrapperRef} id="password" codeLength={6} type="alphanumeric" hide={false} value={password} onChange={(res) => { setPassword(res); }} customStyleComponent={{ maxWidth: "300px", margin: "0 auto" }} />

or even like this directly it doesn't work value={"123456"}

so basically unless I actually type it in, there is no way to set the value via code , is there ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.