Comments (3)
Hi @chloe-schoreisz, thank you for your question.
The focus can be set using the focus() method provided by the <MessageInput /> component.
e.g.
const inputRef = useRef();
const [disabled, setDisabled] = useState(false);
const sendMessage = () => {
setDisabled(true);
senToWire().then( () => {
inputRef.current.focus();
setDisabled(false);
});
<MessageInput ref={inputRef} onSend={sendMessage} disabled={disabled} />
from chat-ui-kit-react.
Thanks for the solution ! Would this be considered a common use case ? I wonder if it this behaviour should be native to the component.
What other common use cases for the disable
props do you have ?
from chat-ui-kit-react.
@chloe-schoreisz I'm not sure if it is a common use case.
Why do you want disable the input, when a message is sending? If you do it, the user will not be able to write the next message untill the previous one is sent.
What exactly behavior do you consider native, disabling while sending or refocus after sent?
BTW, sorry I forgot about one property activateAfterChange it's meant for a different use case, but you can try setting it to true to automagically set the focus after sending.
Other common use cases for the disabled prop are for example when you have no active user selected, or when connection to server has not been established. Depending on the application, you may also want to block messages from being sent to the user when they are not connected.
from chat-ui-kit-react.
Related Issues (20)
- MessageGroup.Footer with Avatar looks odd
- Expose onKeyPress for MessageInput
- Allow using send button when there is no message text HOT 3
- Scroll to message on browser-native find
- Regarding Chat Reply UI of one another user HOT 1
- IOS 16 version issue of clicking button as Message.CustomContent HOT 3
- Unexpected overflow on ChatContainer HOT 2
- transitionning between the chatcontainer and the sidebar in mobile display HOT 3
- Simple styling with tailwind
- Unexpected width and height change inside components in Message.HtmlContent. HOT 1
- [HELP] How to use the streaming message feature? HOT 4
- Not working on Next.js HOT 4
- Bug: unable to use scroll bar when using custom css HOT 1
- The requested module '/node_modules/prop-types/index.js' does not provide an export named 'default' HOT 1
- Getting started!
- Warning from FontAwesomeIcon about using defaultProps
- Set message input value from another component HOT 1
- Is there a way to actually set a proper max-length for MessageInput? HOT 1
- Avatar isn't displayed when custom content is used
- Sass deprecation warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chat-ui-kit-react.