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

Android no longer scrolls to input on initial focus #23564

Open
Jackman3005 opened this issue Jul 17, 2023 · 8 comments
Open

Android no longer scrolls to input on initial focus #23564

Jackman3005 opened this issue Jul 17, 2023 · 8 comments

Comments

@Jackman3005
Copy link

Jackman3005 commented Jul 17, 2023

Summary

Hello, we have been upgrading from SDK 47 to 49 and have noticed a regression in behavior with Android and how it behaves when you click on a TextInput towards the bottom of the screen. The keyboard comes up and covers the input now (at least initially). If I make repeated focus changes the follow-up ones will actually scroll to the input if the keyboard will cover it, but for multi-line inputs it now only scrolls to show the top of the input, not the full input like it used to.

I have tried many combinations of changing the React Native KeyboardAvoidingView (KAV in the table below) behavior (including disabling it) and the Android's Keyboard layout setting defined in the App Config: (softwareKeyboardLayoutMode: 'pan'). Each of the possible combinations resulted in the regression or other regressions.

KAV Behavior 'pan' layout 'resize' layout
position keyboardLayout-pan-kav-position.webm keyboardLayout-resize-kav-position.webm
padding keyboardLayout-pan-kav-padding.webm keyboardLayout-resize-kav-padding.webm
height keyboardLayout-pan-kav-height.webm keyboardLayout-resize-kav-height.webm
disabled keyboardLayout-pan-kav-disabled.webm keyboardLayout-resize-kav-disabled.webm

Unfortunately I was not having any success building our app with Expo 48, so I cannot definitively say if this was introduced going from 47 to 48 or 48 to 49 . Edit: @louislatreille confirmed below that it happens when upgrading from Expo 48 to 49

Minimal reproducible example

https://snack.expo.dev/@jcoy/belligerent-stroopwafels

Note: I have provided a Snack,but the Expo snack UI seems to be crashing on Android right now for both physical device and the device they offer.

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
      Yarn: 1.22.19 - ~/workspace/qm-universe/node_modules/.bin/yarn
      npm: 9.6.0 - ~/.nvm/versions/node/v16.14.0/bin/npm
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.10121639
      Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
    npmGlobalPackages:
      eas-cli: 3.15.0
      expo-cli: 6.3.10
    Expo Workflow: bare
@Jackman3005 Jackman3005 added the needs validation Issue needs to be validated label Jul 17, 2023
@Jackman3005 Jackman3005 changed the title Android no longer scrolls to input on focus Android no longer scrolls to input on initial focus Jul 17, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Jul 17, 2023
@Taktime-L
Copy link

+1

@Jackman3005
Copy link
Author

Who would be best to take a look at this?

@sreuter
Copy link
Contributor

sreuter commented Aug 2, 2023

This is still blocking us from moving to Expo 49. @brentvatne, may we ask you or somebody from the team to have a look and review the recordings?

@louislatreille
Copy link

louislatreille commented Aug 17, 2023

I'm getting the same error after upgrading to SDK 49. I can confirm that the issue has been introduced by SDK 49, as I was on 48 before.

The snack @Jackman3005 has provided is on expo 47. I've re-used most of it and upgraded to SDK 49 and can easily reproduce the issue. Made a reproduction repo: https://github.com/louislatreille/keyboardIssueExpo49

@Jackman3005
Copy link
Author

@louislatreille Thank you for creating a legitimate reproduction! This is stopping us from upgrading to Expo 49 for the time being.

@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@keith-kurak
Copy link
Contributor

keith-kurak commented Aug 18, 2023

Hi all!

I tried the code in the repro's App.js in SDK's 47, 48, 49, and found it scrolled correctly to a TextInput below keyboard height in 47 and 48, but not 49. (repro with a branch for each one).

ScrollView/ Keyboard interaction is a pretty core-level thing that wouldn't likely be affected by a new SDK directly, but new Expo SDK's generally ship with updated versions of react-native. To that end, I found this issue and its associated PR here, which shipped in RN 72.4 (SDK 49 is currently on 72.3): facebook/react-native#38152

I then created a project with the RNC CLI (npx react-native@latest init ProjectName), ran it on Android, and they scroll interaction worked. I then downgraded it to RN 72.3 and it behaved just like the SDK 49 project. Thus, I think it was an RN regression that was later fixed.

I've accepted this issue and will raise it internally so we can see if it would work to up the react-native version.

In terms of fast workaround, the actual PR that fixed this is quite small (facebook/react-native#38728), and I think it would be straightforward to apply with patch-package, and then you could get that fix right away with a development build or in your production code (just not in Expo Go).

I would also recommend trying to reproduce the issue on the latest RN, just in case there's a scenario that it doesn't cover, so another issue can be opened on the RN repo if needed.

@keith-kurak keith-kurak removed the needs review Issue is ready to be reviewed by a maintainer label Aug 18, 2023
@louislatreille
Copy link

Big thanks @keith-kurak for going to the bottom of that issue!

I can confirm that after upgrading to RN 72.4, my keyboard works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants