Skip to content

KeyboardAwareScrollView applies unexpected bottom gap in contentContainerStyle #929

@Ikthegreat

Description

@Ikthegreat

Describe the bug
When using KeyboardAwareScrollView from react-native-keyboard-controller, contentContainerStyle.gap is applied differently compared to a regular ScrollView.

  • A gap is applied to the bottom of the content, even though this is not expected.
  • Additionally, when gap: 0 is explicitly set, there is still 1px of bottom spacing rendered.
  • This inconsistency does not occur with a normal ScrollView.

Code snippet

<KeyboardAwareScrollView
  contentContainerStyle={{
    backgroundColor: 'black',
    gap: 10,
  }}>
  {array.map((_, index) => (
    <View key={index} style={{ backgroundColor: 'red', height: 20 }} />
  ))}
</KeyboardAwareScrollView>

<KeyboardAwareScrollView
  contentContainerStyle={{
    backgroundColor: 'black',
    gap: 0,
  }}>
  {array.map((_, index) => (
    <View key={index} style={{ backgroundColor: 'red', height: 20 }} />
  ))}
</KeyboardAwareScrollView>

Repo for reproducing

Expo snack Link

To Reproduce

  1. Go to Expo snack
  2. See Layout

or

  • Render a KeyboardAwareScrollView with contentContainerStyle.gap set.
  • Compare it to a regular ScrollView with the same style.
  • Observe the extra space at the bottom in KeyboardAwareScrollView.

Expected behavior

  • The behavior of contentContainerStyle.gap should match that of ScrollView.
  • No extra bottom spacing should be added when gap: 0 is specified.

Screenshots
Image

Smartphone (please complete the following information):

  • Desktop OS: Mac OS 15.4
  • Device: iPhone 13 Pro, Galaxy Z Flip 4
  • OS: iOS 18.3.2, Android 14
  • RN version: 0.76.9
  • RN architecture: old
  • JS engine: Hermes
  • Library version: 1.15.2

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