kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.75k stars 78 forks source link

Keyboard hides input after autofill on Android #665

Closed antonandreyev closed 2 weeks ago

antonandreyev commented 2 weeks ago

Describe the bug When using autofill on Android with Google password manager inside KeyboardAwareScrollView, keyboard behaves like this:

Code snippet

export const App = sentryWrap(() => {
  return (
    <Providers>
      <LoginOTPEmailScreen />
    </Providers>
  );
});

function LoginOTPEmailScreen() {
  const [value, setValue] = useState("");

  return (
    <KeyboardAwareScrollView keyboardShouldPersistTaps="handled">
      <View style={{ height: 600 }} />
      <TextInput
        accessibilityLabel="Text input field"
        style={{ borderWidth: 1 }}
        value={value}
        autoComplete="username"
        keyboardType="email-address"
        autoCorrect={false}
        autoCapitalize="none"
        onChangeText={setValue}
      />
    </KeyboardAwareScrollView>
  );
}

export const Providers = ({ children }) => {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <SafeAreaProvider initialMetrics={initialWindowMetrics}>
        <KeyboardProvider statusBarTranslucent>{children}</KeyboardProvider>
      </SafeAreaProvider>
    </GestureHandlerRootView>
  );
};

Repo for reproducing N/A, full code provided in the snippet.

To Reproduce See the video and follow steps in description

Expected behavior On the second keyboard appearance keyboard avoidance works

Screenshots

https://github.com/user-attachments/assets/ccbf2599-4f4e-4800-aad9-0d3f320398bd

Smartphone (please complete the following information):

Additional context "react-native-gesture-handler": "^2.20.2", "react-native-reanimated": "~3.15.5", "react-native-safe-area-context": "^4.12.0",

kirillzyusko commented 2 weeks ago

@antonandreyev thank you for the issue! I'm able to reproduce it 🎉

I opened a PR with a potential fix - https://github.com/kirillzyusko/react-native-keyboard-controller/pull/667

May I ask you to test it and let me know how it works for you?

antonandreyev commented 2 weeks ago

Yes, I can confirm it helped! But also I can note little regression in the actual app: Status bar loses (or gains) color when password manager is visible (it returns back once manager is hidden). Context:

I will try to find time tomorrow to create a reproduction repo

kirillzyusko commented 2 weeks ago

I will try to find time tomorrow to create a reproduction repo

Thank you, because StatusBar doesn't change a color in my example app 🙂

Feel free to open a new issue then 🙌 (I'll merge a PR and this issue will be automatically closed)