Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i forbid to type text in mention input without disabling? #91

Open
lactivka opened this issue Jul 14, 2022 · 0 comments
Open

How can i forbid to type text in mention input without disabling? #91

lactivka opened this issue Jul 14, 2022 · 0 comments

Comments

@lactivka
Copy link

lactivka commented Jul 14, 2022

I have local message state
const [message, onChangeMessage] = useState('')
Value of message changes by input. When i send message i need to clear input and forbid type new value without disabling the input field (because disable state makes keyboard close, but it must be always open)
I can do this with TextInput from react native by passing in props this onChangeText function

onChangeText={
            val => {
		if (!isSending) {
			inputRef.current.clear()         // clear input by ref
			onChangeMessage('')           // clear massage state
		} else {
			onChangeMessage(val)
		}

It prevents typing new text in input while prev message is sending.
But if i pass same function to onChange prop of mention input it not works and i still can type text and change input's value. In the same time local message state not changes, it is empty string while is sending

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant