Skip to content

After upgrading the Android targetSdkVersion to 35, the TextInput text is no longer vertically centered when typing on Android 15. #52775

@BS3385

Description

@BS3385

Description

I upgraded React Native from version 0.73.2 to 0.80.1 and also updated the targetSdkVersion to 35. After the upgrade, I noticed that when entering text in the TextInput component, the text is vertically shifted upwards, while the cursor remains vertically centered.

Here’s the style I was using:

style={{
  backgroundColor: '#eee',
  height: 40,
  paddingTop: 10,
  paddingBottom: 10,
  lineHeight: 20,
  fontSize: 16,
  includeFontPadding: true,
  textAlignVertical: 'center',
}}

The result looks like this:
Image

However, if I change the style to:

style={{
  backgroundColor: '#eee',
  height: 40,
  lineHeight: 40,
  fontSize: 16,
}}

The result looks like this:
Image

And if I remove the height:

style={{
  backgroundColor: '#eee',
  lineHeight: 40,
  fontSize: 16,
}}

The result looks like this:

Image

Steps to reproduce

1、Updated the targetSdkVersion to 35
2、Write the following components

<TextInput
    keyboardType="numeric"
    placeholderTextColor="#999"
    style={{
        backgroundColor: '#eee',
        height: 40,
        paddingTop: 10,
        paddingBottom: 10,
        lineHeight: 20,
        fontSize: 16,
        includeFontPadding: true,
        textAlignVertical: 'center',
    }}
/>

3、Running on Android 15(My phone is Xiaomi 15)

React Native Version

0.80.1

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 135.30 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 4.9.2
    path: ~/.nvm/versions/node/v18.18.0/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2024.08.12.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.0.0
    wanted: 19.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.1
    wanted: 0.80.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

none

MANDATORY Reproducer

https://snack.expo.dev/@bs3385/textinput

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputRelated to the TextInput component.Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions