StaticMania / keep-react

Keep React is an open-source component library built on Tailwind CSS and React.js. It provides a versatile set of pre-designed UI components to build modern web applications.
https://react.keepdesign.io
MIT License
1.32k stars 115 forks source link

possible issue with input value on <TextInput /> #134

Closed kypanz closed 7 months ago

kypanz commented 7 months ago

Hello guys today i try to use the setState in a reactjs component and i see the <TextInput /> component has the value property but this is not update when the message is changed, maybe i am wrong but can you check ?, this is the example code :

<form onSubmit={sendMessage}>

  <div className="p-5 flex space-x-5 bg-sky-600 m-auto justify-center">

    <div className="w-[50%]">
        <TextInput
            id="input-x-chatbot"
            placeholder="Default Input Field" color="gray"
            value={message}
            handleOnChange={(e) => setMessage(e.target.value)}
        />
    </div>
    <div>
        <Button type="primary"> Send </Button>
    </div>

  </div>
</form>

The documentation of the component is this one : https://react.keepdesign.io/docs/components/textInput

I anyone more have this issue, I solved temporally calling the document and rewriting the value :

const msg = document.getElementById('input-cognitus-chatbot');
msg.value = '';

is not the best option but works for now

When i have a little time this wekeend i gonna check if i can help in this because are interesting components and can increase the productivity

If i am wrong or anyone have a better option please let me know

Have a nice week guys :rocket:

Arifulislam5577 commented 7 months ago

Hello @kypanz,

After testing the functionality myself, I can confirm that there doesn't seem to be any issue with the value property of the component. It appears to be updating properly when the message is changed.

If you're encountering any discrepancies, I would recommend ensuring that you're using the latest version of Keep React. Sometimes, updates and improvements are made in newer versions that address such issues.

If you have any further questions or need assistance, please feel free to reach out. We're here to help!

Best regards, Md Ariful Islam,

image