Coder Social home page Coder Social logo

Comments (6)

SleepWalker avatar SleepWalker commented on August 11, 2024 2

Faced the same issue with custom phone number input. Event handler need the actual DOM node to handle cursor position.

rc-input creates a copy or original DOM node here https://github.com/react-component/input/blob/master/src/utils/commonUtils.ts#L60-L75. If you'll try to manipulate with that node it won't be reflected on the original node because it's just a copy that even wasn't inserted in DOM and of course it has zero cursor position.

As a temporary solution I using ref and patch the event back:

const inputRef = React.useRef<InputRef>(null);

return (
  <Input onChange={(event) => {
    const currentTarget = inputRef.current!.input;

    event = Object.create(event, {
      target: { value: currentTarget },
      currentTarget: { value: currentTarget },
    });

   handleChange(event);
  }} />
);

from input.

afc163 avatar afc163 commented on August 11, 2024

@yyz945947732 Look at this issue.

from input.

0307kwon avatar 0307kwon commented on August 11, 2024

I have same issue... 😢

from input.

afc163 avatar afc163 commented on August 11, 2024

@yyz945947732 ping~

from input.

afc163 avatar afc163 commented on August 11, 2024

@yyz945947732

from input.

afc163 avatar afc163 commented on August 11, 2024

Fixed in #65

from input.

Related Issues (14)

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.