Skip to content

KeyboardAwareScrollView: justifyContent: "space-between" is not working properly in contentContainerStyle #645

@Isaccobosio

Description

@Isaccobosio

Describe the bug
Configuring the property contentContainerStyle for KeyboardAwareScrollView with justifyContent: "space-between" does not work as expected.
If I do the same thing with ScrollView it works fine.

Code snippet

<KeyboardAwareScrollView
      style={{ backgroundColor: "green" }}
      contentContainerStyle={{
        flexGrow: 1,
        backgroundColor: "blue",
        justifyContent: "space-between",
      }}
    >
      <View style={{ height: 100, backgroundColor: "red" }} />
      <View style={{ height: 100, backgroundColor: "red" }} />
</KeyboardAwareScrollView>

Expected behavior
As a Scrollview, I expect that the two View inside the KeyboardAwareScrollView is positioned with a space between them.
What I am trying to create is a screen in the upper part of which there is a login form and in the lower part buttons for logging in with the various societies.
If the screen size is not large enough, the two main components will have to scroll.

Screenshots

With KeyboardAwareScrollView With ScrollView (expected)
image image

Smartphone

  • RN version: 0.74.5
  • Library version: 1.14.2

Additional context
I also tried to put a View between the two main Views like this:

<KeyboardAwareScrollView
      style={{ backgroundColor: "green" }}
      contentContainerStyle={{
        flexGrow: 1,
        backgroundColor: "blue",
        justifyContent: "space-between",
      }}
    >
      <View style={{ height: 100, backgroundColor: "red" }} />
      <View style={{ flex: 1 }} />
      <View style={{ height: 100, backgroundColor: "red" }} />
</KeyboardAwareScrollView>

But this is the result:
image

As you can see in the bottom of the screen there is a little blue space (maybe a pixel). This means that the two Views are not displayed correctly. Is like a ghost View is displayed:
image

Metadata

Metadata

Assignees

Labels

KeyboardAwareScrollView 📜Anything related to KeyboardAwareScrollView component🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions