Closed
Description
Description
When typing inside a multiline textInput, after around 300 - 400 characters, CPU shoots up to 100%. Once you stop typing, CPU goes back down. Typing a few more characters causes the CPU to shoot up to 100% again.
This happens in simulator and device and sometimes leads to a crash.
This does not happen where there is no child and the value prop is used.
Reproduction Steps and Sample Code
Sample code follows, using Sample React Native App using nothing but TextInput. Remember, you need to have around 300 - 400 characters in the input to start seeing the problem.
import React, { Component } from 'react';
import {
AppRegistry,
Text,
View,
TextInput
} from 'react-native';
export default class textInput extends Component {
constructor(props, context) {
super(props, context);
this.state = {
text: ''
};
}
render() {
return (
<View style={{ flex: 1 }}>
<TextInput
style={{flex: 1, marginTop: 100 }}
multiline
onChangeText={(text) => this.setState({ text })}
>
<Text>{this.state.text}</Text>
</TextInput>
</View>
);
}
}
AppRegistry.registerComponent('textInput', () => textInput);
Solution
?
Additional Information
- React Native version: 0.44.0
- Platform: iOS
- Development Operating System: macOS
- Dev tools: Xcode