douglasjunior / react-native-keyboard-manager

⚛ Library to prevent issues of keyboard sliding up and cover inputs on React-Native iOS projects.
https://www.npmjs.com/package/react-native-keyboard-manager
MIT License
952 stars 60 forks source link

iOS setKeyboardDistanceFromTextField is not working as expected #87

Closed mydesweb closed 2 years ago

mydesweb commented 2 years ago

After upgrading react-native and react-native-keyboard-manager to latest versions, setKeyboardDistanceFromTextField is not working properly, even if I set 0 as a value there is a space between the input and the keyboard. When the Keyboard is opened it pushes my content too much.

The TextInput is inside a ScrollView, and after I manually scroll inside the list while the Keyboard is still opened the extra space is somehow removed and the TextInput remains sticky to the Keyboard which is what I want to see. (the TextInput is the last element in my list, this is why it remains sticky, there is no other content after it)

I also noticed a difference in behaviour when using a multiline TextInput vs a regular one.

https://user-images.githubusercontent.com/5901386/153760640-a355ab70-1067-4e69-a919-847c6da3b119.mp4

Source code for the screen

  return (
    <View style={{flex: 1, backgroundColor: 'green'}}>
      <ScrollView
        // contentInsetAdjustmentBehavior={'never'}
        style={{backgroundColor: 'blue'}}>
        <View
          style={{
            height: 600,
            backgroundColor: 'yellow',
            justifyContent: 'center',
            alignItems: 'center',
          }}>
          <Text>Some content</Text>
        </View>
        <TextInput
          // multiline={true}
          style={{backgroundColor: 'red'}}
          placeholder={'TextInput'}
        />
      </ScrollView>
    </View>
  );
douglasjunior commented 2 years ago

Its working on the Sample Project.

(Focus on textarea 3)

WhatsApp Image 2022-02-14 at 09 06 37

WhatsApp Image 2022-02-14 at 09 06 37 (1)