-
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] [android] setNativeProps({text:<string>}) repeats characters #24409
Comments
The same problem occurred when using toUpperCase() or toLowerCase() and the entered value !== tranformed |
I'd like to work on this issue. |
why don't you update input value via |
@kmagiera This bug is manifested not only when using |
It think that using setNativeProps for this purpose is wrong, and you should be doing something like below. Closing this issue. import React, {Component} from 'react';
import {Text, View, TextInput} from 'react-native';
type Props = {};
export default class App extends Component<Props> {
state = {
text: ''
}
render() {
return (
<View style={{paddingTop:200}}>
<TextInput
style={{width:"100%",backgroundColor:"yellow"}}
onChangeText={text=> this.setState({ text: text.toUpperCase() })}
value={this.state.text}
/>
</View>);
}
} |
@dulmandakh I'm really sorry, but the example you posted also exhibits the same bug https://snack.expo.io/HJhmOGAtN I think something is wrong somewhere. Is it going to be a problem to keep the issue open? |
I can reproduce the issue, thank you. |
but only with toUpperCase(), without it the app just works. |
Thanks @dulmandakh :) Yes, you are right - without toUpperCase, both methods seem to work. It does not necessarily have to be toUpperCase(), for example, this example that redacts vowels has the same problem https://snack.expo.io/BkbQrVCtN - again - only in android. Interestingly, if there are numbers at the beginning of the string, the problem doesn't happen. |
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. |
I am running across this issue now, I am uppercasing the string via style |
This is also happening on |
i've been receiving the same bug report from a couple of users and didn't know where it is lying until i viewed this issue. yes i "am" also transforming the text somehow and i can also confirm that the problem occurs when characters are being typed rather than numbers. but i'm definitely sure the problem occurs only on specific devices not all of them (apparently android version has nothing to do with the issue). using RN 0.57 at the moment |
Facing same issue on Android for below environment System:
Binaries:
IDEs:
npmPackages:
npmGlobalPackages:
|
Worked for me |
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. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
not work on iOS: React native 0.63.4 |
I'm encountering this issue on Android on react-native 0.64.3. |
🐛 Bug Report
Setting the text of a TextInput on Android via
setNativeProps({text:<string>})
repeats existing charactersTo Reproduce
Add a TextInput in Android and capture a ref to it. Add an
onChangeText
handler to the TextInput, and in this, set the text of the input to some function of the current text.As characters are typed into the input, the text will repeat previously input characters in addition to the value of the string used in setNativeProps.
Expected Behavior
Setting the text via
setNativeProps({text:<string>})
should set the text of the input to just<string>
with no repeated characters.Code Example
On latest react native, via react-native init
Link to snack:
https://snack.expo.io/Hk-z-q3FV
Environment
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 216.29 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.15.1 - ~/.nvm/versions/node/v8.15.1/bin/node
Yarn: 1.12.3 - ~/.yarn/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.15.1/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 25, 26, 27, 28
Build Tools: 25.0.3, 28.0.3, 29.0.0
System Images: android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 2.3 AI-162.3871768
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.4
The text was updated successfully, but these errors were encountered: