I'm facing a problem with android.
Each time i send a message the input seems to be cleared but when i start typing again the previous value is merged to the new value.
Ex : if i want to send 2 messages "Hello" and "World"
first i send "Hello" then when i start to write "World" my input display "HelloW" so the value of the last send is merged to the new value.
This happend only on android. i've tried to manually manage by affecting the value of onInputTextChanged to text props and then clear it at each send but it doesn't fix it.
Any suggestion ?
+1
Okay i located the issue. It is caused by KeyBoardSpacer. When i remove it, i no longer get this problem. However without KeyBoardSpacer my chat view disappear when the keyboard show up. So i still need an alternative to `KeyBoardSpacer to push my view up when i want to start typing.
Suggestions ?
+1
const clearTextState = () => {
this.setState({ text: '' })
}
call this function inside onSend
const onSend = (message) => {
//send message
return clearTextState()
}
inside gifted chat
<GiftedChat value={this.state.text} />
Hi @Anees-Raja , could you please add more details about your solution?
Also facing this issue on Android. I tried @Anees-Raja's advice and still couldn't get it to work.
Found a workaround. I have two different Galaxy S7's and one of them had autosuggest/correct on by default. That phone was the one having this issue. I forced autoCorrect off in Gifted Chat and this issue went away.
Just add this prop to your GitftedChat component:
textInputProps={{
autoCorrect: false
}}
Hi, i have the same problem. Did you found any fix for this? Disabling auto correct in my opinion isn't good fix. I want have enable auto correct.聽Clearing text in state on send also don't work
A dirty workaround for this that I'm currently using is setting the autoCorrect prop to false and then true again onSend (only for Android devices).
state = {
messages: [],
androidAutoCorrectFix: true,
}
onSend(messages = []) {
this.setState(
previousState => ({
messages: GiftedChat.append(previousState.messages, messages),
androidAutoCorrectFix: Platform.OS !== 'android'
}),
Platform.OS === 'android' && (() => this.setState({androidAutoCorrectFix: true}))
)
}
render() {
return (
<GiftedChat
textInputProps={{
autoCorrect: Platform.OS === 'ios' || this.state.androidAutoCorrectFix
}}
messages={this.state.messages}
onSend={messages => this.onSend(messages)}
user={{
_id: 1
}}
/>
)
}
Is this fixed or anything?
@richardmillen94 This solution is weird because i think it only corrects the last word right?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm having the same issue
I've tried both controlling gifted chat text and turning off autocomplete and neither of them helped me, any other suggestions?
I'm seeing this on android as well right now. Disabling autocorrect completely resolves the issue, but of course presents it's own issues.
I've tried both controlling gifted chat text and turning off autocomplete and neither of them helped me
Anyone fixed that?
I'm seeing this on android as well right now. Disabling autocorrect completely resolves the issue, but of course presents it's own issues.
please tell me how did you disable autocorrect, I can't disable autocorrect
I'm still with this issue, i was try everything here , autocorrect, cleartext, block input when sending, but i still with this problem.
RN 59.8
GIfted-chat 0.9.6
Platform: Android
+1
+1
Please open a new issue with an expo snack example to be able to reproduce with exact android version.
Thanks
Most helpful comment
Found a workaround. I have two different Galaxy S7's and one of them had autosuggest/correct on by default. That phone was the one having this issue. I forced autoCorrect off in Gifted Chat and this issue went away.
Just add this prop to your GitftedChat component: