-
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
TextInput onChangeText callback was not invoked on Android #23663
Comments
@tianjyan try moving your renderItemsView function above TextInput render() {
return (
<View style={styles.container}>
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.textInput.focus();
}}
>
{this._renderItemsView()}
<TextInput
ref={this.bindRef}
autoFocus
maxLength={6}
keyboardType="numeric"
onChangeText={this._onChangeText}
style={styles.textInput}
/>
</TouchableOpacity>
</View>
);
} |
Cool, that works. @jacoahmad Could you tell me the theory ? |
I'm not sure what's the root cause is, but looking at your code, if you want to have a hidden input, I think you don't have to put your You can write it this way render() {
return (
<View style={styles.container}>
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.textInput.focus();
}}
>
{this._renderItemsView()}
</TouchableOpacity>
<TextInput
ref={this.bindRef}
autoFocus
maxLength={6}
keyboardType="numeric"
onChangeText={this._onChangeText}
style={styles.textInput}
/>
</View>
);
} |
@jacoahmad Thank you for your response. You are right, I don't have to put the input inside the TouchableOpacity. But put it inside TouchableOpacity does not break the language specific. So I think this is still a bug. |
@tianjyan Yes, it won't break the I'm not sure how to avoid an event listener on the parent of |
@jacoahmad I think avoiding the event listener is not the topic for this issue. I can still input |
TextInput inside touchable opacity event firing behaviour could be related to: #23720 |
I am facing the same issue
The interesting thing is when I put default value TextInput render with that value but again I type Ex:
|
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. |
🐛 Bug Report
When I set TextInput's
padding
is 0 andkeyboardType
is numeric on Android,onChangeText
was not invoked when I was typing numbers.To Reproduce
See "Code Example" section.
Expected Behavior
onChangeText
should be invoked when I am typing numbers.Code Example
You can also get the whole project at https://github.com/tianjyan/textinput_issue .
Environment
The text was updated successfully, but these errors were encountered: