question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextInput issue on Android 13 devices

See original GitHub issue

Hi, I’ve noticed an issue with TextInputs on Android 13 devices, where the input will lag significantly, especially for long text inputs and when deleting a lot of text by press/holding backspace.

The underlying issue and a (not perfect, but seemingly working) solution is discussed here: https://github.com/facebook/react-native/issues/35155#issuecomment-1303994598

I’ve put in place the suggested fix locally using patch-package. Although I know it’s not an issue with react-native-gifted-chat, this seems to fix the issue in my app.

I’ve not been able to test this extensively yet, but posting in case it’s useful to others.

diff --git a/node_modules/react-native-gifted-chat/lib/Composer.js b/node_modules/react-native-gifted-chat/lib/Composer.js
index 3331d31..f92956f 100644
--- a/node_modules/react-native-gifted-chat/lib/Composer.js
+++ b/node_modules/react-native-gifted-chat/lib/Composer.js
@@ -49,6 +49,8 @@ export default class Composer extends React.Component {
         this.onChangeText = (text) => {
             this.props.onTextChanged(text);
         };
+        // Fix issue with lagging TextInput on Andoid 13 discussed here: https://github.com/facebook/react-native/issues/35155#issuecomment-1303994598
+        this.isAndroid13 = Platform.OS === 'android' && Platform?.constants?.Release === '13'
     }
     render() {
         return (<TextInput testID={this.props.placeholder} accessible accessibilityLabel={this.props.placeholder} placeholder={this.props.placeholder} placeholderTextColor={this.props.placeholderTextColor} multiline={this.props.multiline} editable={!this.props.disableComposer} onChange={this.onContentSizeChange} onContentSizeChange={this.onContentSizeChange} onChangeText={this.onChangeText} style={[
@@ -64,7 +66,7 @@ export default class Composer extends React.Component {
                     },
                 }),
             },
-        ]} autoFocus={this.props.textInputAutoFocus} value={this.props.text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={this.props.keyboardAppearance} {...this.props.textInputProps}/>);
+        ]} autoFocus={this.props.textInputAutoFocus} value={this.props.text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={this.props.keyboardAppearance} {...this.props.textInputProps} keyboardType={this.isAndroid13 ? 'visible-password' : 'default'} />);
     }
 }
 Composer.defaultProps = {

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

1reaction
levepiccommented, Dec 22, 2022

fkiDev So I have added your suggested fix and also added the fix to make ScaleY still available on RN 0.70 in index.js

// Add scaleY back to work around its removal in React Native 0.70. import ViewReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes' ViewReactNativeStyleAttributes.scaleY = true

and the ANRs are gone from production! Finally fixed it. Thank you!

i solve the problem from here: facebook/react-native#30034 (comment)

1reaction
fkiDevcommented, Dec 13, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

TextInput is causing app to hang in Samsung devices ... - GitHub
Our app is throwing ANRs when users with Samsung devices with Android 13 are typing in input fields. We had a similar issue...
Read more >
Crash on Samsung devices due to TextInput : r/reactnative
Have tried replicating the flow on an Oppo R7 with Android 12 (same version as the Samsung Galaxy series), but not able to...
Read more >
Why does TextInput not work on my Xiaomi device in React ...
For some reason I'm unable to use any TextInput on my device. It works on my other Samsung phone and works in emulator...
Read more >
Fix problems with Gboard - Android - Google Support
On your Android phone or tablet, open the Settings app Settings app . Tap System and then Languages and input. Tap Virtual keyboard...
Read more >
Notification runtime permission - Android Developers
Android 13 (API level 33) and higher supports a runtime permission for sending non-exempt (including Foreground Services (FGS)) notifications from an app: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found