APSL / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
MIT License
5.24k stars 643 forks source link

Android: Keyboard has a invisible top that pushed view #567

Closed afu1995 closed 1 year ago

afu1995 commented 1 year ago

Hey Guys, As said in the title i'm experiencing an Android issue when I press an input-field the keyboard activates and pushed the view far top. BUT the view adjust to the correct placement when I start typing. Please look at my video.

https://user-images.githubusercontent.com/79371290/233310864-1b60438c-78bd-4e4c-9c60-3110a166a92a.mp4

import React from 'react';
import { Keyboard, KeyboardAvoidingView as RNKeyboardView, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import { isAndroid } from '~/app/helpers/Settings';

type Props = {
  children: React.ReactNode;
  dismissOnChildrenTouch?: boolean;
};

export function KeyboardAvoidingView({ children, dismissOnChildrenTouch = true }: Props) {
  return (
    <RNKeyboardView
      style={Styles.Keyboard}
      contentContainerStyle={Styles.ContentContainer}
      behavior={isAndroid ? 'height' : 'padding'}>
      <TouchableWithoutFeedback onPress={dismissOnChildrenTouch ? Keyboard.dismiss : undefined}>
        {children}
      </TouchableWithoutFeedback>
    </RNKeyboardView>
  );
}

const Styles = StyleSheet.create({
  Keyboard: {
    flex: 1,
  },
  ContentContainer: {
    flex: 1,
  },
});
IordanisSap commented 1 year ago

How did you solve that?

anhquan291 commented 9 months ago

Facing the same problem. Did you find a solution for that @afu1995 ? Thank you so much

AlaaMX commented 6 months ago

+1

kenanallahverdiev commented 1 month ago

Can anyone share the solution please?