-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Crash on email detection in TextInput on Xiaomi devices running android 10 #27204
Comments
having the same issue =( |
Same problem here. It only happens on Xiaomi devices running Android 10. |
We also fixed this hacky with a hooks version of #20887 (comment) It works but it breaks the
|
I have a user that is experiencing this same issue. Is it related to the autofocus when going to a screen? It's quite hard to replicate but had a couple of crashes when trying it myself. |
It happened to me on screens without any autofocus, but sadly I had not been able to understand what the underlying cause is. |
Same issue here. User gave one star review for this. 😢 |
I have same problem with RN 0.61.4 |
having same issue with RN 0.59.0 |
I try, but cannot fix this crash. |
I think found a workaround. Basically we need to set "secureTextEntry" in true and on "onLayout" method, changed the value into false. |
I think @ musemind's solution fixed my problem. |
Removing |
Same problem here, none of the proposed solutions worked in my production app. I have several thousands of users so far (released a few days ago). The models MI 9 (cepheus), Redmi K20 Pro (raphael), and Mi 9T (davinci), are experiencing this issue, they can't even create an account on my app. And the 1 star review keep coming... |
I had to set <TextInput
caretHidden
autoCapitalize='none'
autoCorrect={false}
keyboardType='email-address'
autoCompleteType='email'
/> |
It would be great if this issue could get some attention from the React Native team. I initially fixed it using the timeout/editable workaround described here and in #20887, but since we migrated from Expo 34 to Expo 36 (React Native 0.61.5), it has returned and the workaround doesn't seem to work anymore. This is exactly the type of bug that causes terrible user experiences, even if it's limited to a set of devices. The users impacted are quick to churn and write 1-star reviews. |
Same issue here on a |
Same here.. +1 |
Same issue here on a MI Mix 2s. |
Yes even if caretHidden is a workaround, it cannot be an acceptable solution as you won't be able to see the cursor in the EditText anymore 😞 |
i have plan for now just use btw. anyone has maybe function which check if device is Xiaomi ? |
What about using |
thats my plan for now, but i don’t have Xiaomi device to check what exactly device model returns, thats why i am asking for it 🤔 |
I am experiencing this issue, any update for this? this happen only when the TextInput is prefilled with email value. |
For temperary fix you can use like this as mentioned at #20887 (comment) : ..
..
constructor(props) {
super(props)
this.state = { editable: false }
}
componentDidMount() {
setTimeout(() => { this.setState({ editable: true }) }, 100);
}
render() {
return (
...
...
<TextInput editable={this.state.editable} />
...
...
)
}
} It's temperary but it works for now. But of course it should be fixed soon as possible. |
+1 |
I found the problem. This is a bug in the mi system on android 10, because it will have a prompt view when you type an email in the input box.When we put the input box in the scroll view, the system failed to locate the prompt view properly, causing the application to crash.If the input field is outside of the scroll view you can avoid this problem and hopefully this will help you out, this is not the optimal solution.Because it might require us to change our layout.That's what I'm going to do. |
It seems this issue was fixed on React native 0.63.3, could someone double-check? https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#fixed |
See comments above. That fix does not necessarily fix it as using default keyboard type does not ensure the issue does not happen. It occurs as soon as an email address like string is inputed. |
It took me some time to find out that if I type a
|
This issue was fixed on React native 0.63.3 go |
Sharing our solution for this problem that uses the This is our text field component that we use instead of calling TextInput directly: import { Platform, TextInput } from 'react-native'
import { getBrand } from 'react-native-device-info'
const EMAIL_CRASH_WORKAROUND_BRANDS = ['m2002j9g', 'm2002j9g', 'm2004j19c', 'm2007j20cg', 'mi', 'mi', 'mix', 'poco', 'pocophone', 'redmi', 'xiaomi']
const EMAIL_CRASH_WORKAROUND_NEEDED = EMAIL_CRASH_WORKAROUND_BRANDS.includes(getBrand().toLowerCase()) && Platform.Version > 28 I stripped down our code to show the relevant methods of the component: // allows parent to set focus to the input
focus(){
// console.log('set focus to text field')
// set flag so we know if focus() was called
this.wasFocusHandlerCalled = true
this.input.focus()
},
// capture reference to the input
setRef(ref){
this.input = ref
},
render(){
let attribs = {}
// email crash workaround
if(EMAIL_CRASH_WORKAROUND_NEEDED){
if(this.state && this.state.emailCrashEditable)
attribs.editable = 'editable' in this.props ? this.props.editable : true
else
attribs.editable = 'editable' in this.props ? !this.props.editable : false
// console.log(`editable for ${this.props.fieldName}:`, attribs.editable)
}
return (
<TextInput
ref={this.setRef}
{... this.props}
{ ... attribs}
/>
)
} Finally the most important part. We toggle the componentDidMount(){
// 'editable' email crash workaround
if(EMAIL_CRASH_WORKAROUND_NEEDED){
setTimeout(() => {
if(this.hasUnmounted) return // set this in componentWillUnmount
// console.log('set emailCrashEditable')
this.setState({ emailCrashEditable: true }, () => {
if(this.props.autoFocus || this.wasFocusHandlerCalled){
// when focus was set by calling the focus handler then we need to blur it first
if(this.wasFocusHandlerCalled)
this.input.blur()
this.input.focus()
}
})
}, 100)
}
} Looking forward to an actual fix for this in the core code so that we can get rid of this kludgy workaround. |
+1, i use the carretHide but i need a better solution |
La aplicación se rompe cuando se escribe un punto en el control. Al parecer esta solución funciona para mi, en un dispositivo redmi note 9.
=) |
This comment has been minimized.
This comment has been minimized.
I have this problem when I have an input on a screen that is in a bottomNavigator or in a Stack inside the bottomNavigator. I´m using
The caret and disabled workaround are working. |
it sounds the best fix GG man |
Summary: After monitoring scuba for a few days, previous fixes(D23301714 D23331828 (facebook@07a597a)) don't work as expected. I managed to test this issue on a Xiaomi device, the crash didn't happen but the there was a popup "Frequetly used email" on top of email edit text: {F317216473} Getting rid of the popup probably be the right fix. For more context see facebook#27204 Changelog: [Android] - Set caretHidden to true to fix the Xiaomi crash Reviewed By: mdvacca Differential Revision: D23451929 fbshipit-source-id: 521931422f3a46a056a9faa4b10fe93cf4732db0
No crash in React native 0.64.1 but caret is hidden. |
@Bardiamist this is because a totally wrong "fix" was accepted by the core team. As we mentioned here #27204 (comment), #27204 (comment) and #27204 (comment). |
Hi! I have a few crashes related to this issue, too. Any news regarding this? Thanks |
Works for me, not optimal but a seamless solution for me. const [caretLoaded, setCaretLoaded] = useState(true)
useEffect(() => {
setCaretLoaded(false)
}, [])
return (
<InpupText
caretHidden={caretLoaded}
/>
) |
Has anyone tried |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Still issue |
Any solution? |
Try:
See: https://facebook.github.io/react-native/docs/textinput#carethidden |
Sorry... Not working on redmi note 9 pro max. |
you saved my day. thank you |
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days. |
This issue was closed because the author hasn't provided the requested feedback after 7 days. |
Xiaomi devices running android 10 show a little popup with the Text
Frequent email
when they detect a valid email address in the text input currently selected. This feature causes some crashes on my react native app. Sadly I can't reproduce in on an empty project, but it always happens on some inputs in my app. I have not been able to determine the difference between the textinputs that causes the problem and the textinput that does not cause any crash.React Native version: 0.61.2
Steps To Reproduce
test@test.com
). As soon as I type the lastc
(creating a valid email format), the app crashedThe error:
The full stack trace:
The text was updated successfully, but these errors were encountered: