Skip to content

Commit

Permalink
緩解在Android 13上,在輸入欄打字會變得越來越慢、產生ANR的問題:
Browse files Browse the repository at this point in the history
  • Loading branch information
howg0924 committed Oct 2, 2023
1 parent 4569ea7 commit af13b86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export default class Composer extends React.Component {
}

render() {
const bUseDefaultValue = (Platform.OS === 'android' && Platform.Version >= 33);

return (
<TextInput
testID={this.props.placeholder}
Expand All @@ -43,7 +45,8 @@ export default class Composer extends React.Component {
onChangeText={(text) => this.onChangeText(text)}
style={[styles.textInput, this.props.textInputStyle]}
autoFocus={this.props.textInputAutoFocus}
value={this.props.text}
value={bUseDefaultValue ? undefined : this.props.text}
defaultValue={bUseDefaultValue ? this.props.text : undefined}
enablesReturnKeyAutomatically
underlineColorAndroid="transparent"
keyboardAppearance={this.props.keyboardAppearance}
Expand Down

0 comments on commit af13b86

Please sign in to comment.