-
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 flickering when format the text #24585
Comments
This the same things that happens here #23578 so closing as duplicate. |
@thymikee I don't think it's a duplicate. The other issue specifically says it's not an issue for iOS. This issue happens on iOS for sure. More specifically, the other issue is about a corruption of the value that ultimately ends up in state:
In this issue, the state value is ultimately correct however for a brief period the invalid value is shown to the user. If I had to guess its because the native code renders the text input regardless and then it's unset after the JS layer code runs. I believe that's what is happening in the |
I have same issue. I try use onKeyPress & event.preventDefault() but not work. |
I believe that the solution to the problem lies in onChangeText prop |
I can't understand how that kind of big issue still remains unresolved. Input is the most important component for almost all kind of applications and it is obviously flickering when we try to disallow some characters using regex. Input shouldn't take any action until the state given to value prop changes, so when it is controlled. It should wait the state change but it can't. A very famous library like react-native shouldn't have that kind of big bug |
Isn't there a solution found yet? I also have this issue. I'll explain how I begin to have this issue. I added stack navigator to my code. After that I customized my code according to it. After that I started to get this issue. `class LoginForm extends Component {
} const styles = { const mapStateToProps = state => { export default connect(mapStateToProps, { emailChanged, passwordChanged, loginUser })(LoginForm);` Here is my code which has the text inputs. So I added it to my App.js file like below. `class App extends Component { render() {
} export default App;` My text inputs were fine until this moment. After that I added stack and drawer navigators by creating another file. `const SecondNavigator = createDrawerNavigator({ const MainNavigator = createStackNavigator({ const Router = createAppContainer(MainNavigator); const mapStateToProps = state => { export default connect(mapStateToProps, { emailChanged, passwordChanged, loginUser, logOutUser })(Router);` Then I added this file to the App.js since login form is already imported in this file. `class App extends Component { render() {
} export default App;` This is when I started to have this issue. Navigation was fine. Every other operation works fine. But text input is Flickering. If anyone has an idea of how to solve it, please advise. |
I also have this issue und would love it to be solved or at least learn about a workaround! Cheers |
I think I found an answer to this issue, and almost due to sheer luck, I must say. The answer is short: NEVER use In the example posted by OP, render function should have been:
|
The flickering when trying to prevent certain characters from being inputted is still a problem for me on 0.61.4. I tried @lgenzelis idea, but that doesn't work, my regex code is ignored. I get this on both iOS and Android. Could this ticket be reopened?
|
This comment has been minimized.
This comment has been minimized.
@thymikee Can you please reopen this issue? It's not the same issue as the one you referenced. This bug is a flickering that happens when you try to prevent a character from being displayed in the input onChangeText. The other issue is some android only bug with formatting of uppercase/lowercase letters.. |
@timurridjanovic the original issue is about flickering when formatting the text, there's no preventing default in the OP. Feel free to create a new issue with a detailed reproduction. |
🐛 Bug Report
When trying to format the value and applying the state, the text in text input is flickering:
Any tips to prevent this behavior without the need to change the native code?
To Reproduce
Using the code sample:
A
1
repetitivelyExpected Behavior
The text input should not display the invalid character.
Code Example
Environment
The text was updated successfully, but these errors were encountered: