Skip to content
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's onKeyPress is not working on Android 13 #34496

Closed
tomatoaiu opened this issue Aug 25, 2022 · 2 comments
Closed

TextInput's onKeyPress is not working on Android 13 #34496

tomatoaiu opened this issue Aug 25, 2022 · 2 comments
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@tomatoaiu
Copy link

Description

With Android 13, TextInput's onKeyPress does not respond except for the backspace key.
The "Steps to reproduce" shown below did not work correctly onKeyPress on Android 13, but onKeyPress worked fine on Android 11 (A002SO).

Version

0.69.4

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 12.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 218.36 MB / 32.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.13.2 - ~/.nodenv/versions/16.13.2/bin/node
    Yarn: Not Found
    npm: 8.5.5 - ~/.nodenv/versions/16.13.2/bin/npm
    Watchman: 2022.01.31.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 21, 22, 28, 30, 31, 32, 33
      Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0
      System Images: android-21 | Intel x86 Atom_64, android-21 | Google APIs ARM EABI v7a, android-21 | Google APIs Intel x86 Atom, android-22 | ARM EABI v7a, android-30 | Google APIs ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a, android-33 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 15.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0
    react-native: 0.69.4 => 0.69.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. npm i -g @react-native-community/cli
  2. npx react-native init MyProject --template "[email protected]"
  3. cd MyProject
  4. npm i
  5. Rewrite App.tsx as follows
import React from 'react';
import {SafeAreaView, TextInput} from 'react-native';

const App = () => {
  return (
    <SafeAreaView>
      <TextInput
        onKeyPress={e => {
          console.log(e.nativeEvent);
        }}
        style={{width: '100%', height: 100, borderColor: 'red', borderWidth: 1}} />
    </SafeAreaView>
  );
};

export default App;
  1. start Metro server with npm run start
  2. connect macOS and Pixel6(Android13)
  3. run npm run android in another terminal
  4. if the build is successful, the app will start automatically, enter any characters other than backspace in the TextInput field
  5. the Metro server should display the text you input here, but nothing is output.

Also, when I changed buildToolsVersion etc in android/build.gradle to 33, onKeyPress did not work correctly and did not show any logs.

buildscript {
    ext {
        buildToolsVersion = "33"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

Snack, code example, screenshot, or link to a repository

I have filled in the "Steps to reproduce" with the environment and code samples.

@react-native-bot react-native-bot added Component: TextInput Related to the TextInput component. Platform: Android Android applications. labels Aug 25, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 21, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: TextInput Related to the TextInput component. Needs: Triage 🔍 Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants