React-native-keyboard-aware-scroll-view: Extra empty space on top of the screen

Created on 18 Apr 2017  Â·  18Comments  Â·  Source: APSL/react-native-keyboard-aware-scroll-view

I have worked on moving the Header inside the KeyboardAwareScrollView. And I have 3 text fields ( 2 oneline and one multi-line) below it. When I tap on any of these text fields and then tap outside to dismiss keyboard, I get this empty white space on top.

KeyboardAwareScrollView version: 0.2.8
React native version: 0.43.3
<KeyboardAwareScrollView automaticallyAdjustContentInsets={false} keyboardShouldPersistTaps='always' scrollEventThrottle={10} extraHeight={250} resetScrollToCoords={{x: 0, y: 0}} onKeyboardWillShow={this.onKeyboardWillShow.bind(this)} onKeyboardWillHide={this.onKeyboardWillHide.bind(this)} >

Not sure what I am missing. As per this thread , the latest 0.2.8 should have the fix, but it didnt work for me.

Most helpful comment

Had the same issues. What solves it is to add automaticallyAdjustContentInsets={false} to KeyboardAwareScrollView.

All 18 comments

@shrutic I tried with the code you provide, but cannot find the issue you said. Could you provide a simple demo to reproduce this issue?

I am having the same issue. It works okay in Android simulator but not in iOS simulator.
additional space is added on top of the first text input.

@dylannlaw I tested this with the code:

      <View style={{flex: 1, backgroundColor: '#f6f6f6'}}>
        <KeyboardAwareScrollView
           automaticallyAdjustContentInsets={false}
           keyboardShouldPersistTaps='always'
           scrollEventThrottle={10}
           extraHeight={250}
           resetScrollToCoords={{x: 0, y: 0}}
        >
          <View style={{marginTop: 25}}>
            <Text style={{fontSize: 16}}>
              Header
            </Text>
          </View>
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />

        </KeyboardAwareScrollView>
      </View>

But I cannot reproduce it. Could you write a simple demo to reproduce it?

I think the issue would be produced if you do not wrap the KeyboadAwareScrollview under FULL screen View.
I also have this issue when i call it below a header view
Just guessing

@nguyenhvubk
Like this ?

      <View style={{flex: 1, backgroundColor: '#f6f6f6'}}>
        <View style={{height: 44, backgroundColor: 'blue'}}>
          <Text style={{fontSize: 16, marginTop: 20}}>
            NavigationBar
          </Text>
        </View>
        <KeyboardAwareScrollView
           automaticallyAdjustContentInsets={false}
           keyboardShouldPersistTaps='always'
           scrollEventThrottle={10}
           extraHeight={250}
           resetScrollToCoords={{x: 0, y: 0}}
        >
          <View>
            <Text style={{fontSize: 16}}>
              Header
            </Text>
          </View>
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />
          <TextInput style={styles.textInput} />

        </KeyboardAwareScrollView>
      </View>

Still cannot reproduce. 😕

Still get this issue when put KeyboardAwareScrollView outside, will try your code

Update: my bad... try all your props and it worked wherever it be putted in, thank you very much !!!

@nguyenhvubk
glad to help.

@shrutic @dylannlaw
Do you still get this issue? I'll close this issue later if you don't have other questions.

You might proceed with closing this issue as I tried another library which supported Android at the same time.

Hi @dylannlaw!

Can you point us the library you're using? It might help us to solve the issue. Thanks!

@alvaromb I'm using Native Base component and I wrap all my input component with a container component and it works seamlessly for both iOS and Android.

@dylannlaw Native Base is using keyboard-aware-scroll-view https://github.com/GeekyAnts/NativeBase/blob/master/package.json#L43

@alvaromb ya I am aware of that but it does not have the problem that @shrutic mentioned.

I still get this issue. Very busy to come up with demo app

Sent from my iPhone

On Apr 25, 2017, at 10:39 PM, Dylan Law notifications@github.com wrote:

You might proceed with closing this issue as I tried another library which supported Android at the same time.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

I'll close this issue for now. You can always re-open it after providing a reproducible demo.

Had the same issues. What solves it is to add automaticallyAdjustContentInsets={false} to KeyboardAwareScrollView.

Thank you @MSchmidt ! So to confirm, this is only an iOS issue? automaticallyAdjustContentInsets is an iOS-only prop.

it works! thank u @MSchmidt

This is an upstream issue caused by ScrollView component, it's not related to this library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

diegorodriguesvieira picture diegorodriguesvieira  Â·  4Comments

MyGuySi picture MyGuySi  Â·  3Comments

pinkladywithcoco picture pinkladywithcoco  Â·  3Comments

yasaricli picture yasaricli  Â·  3Comments

EdwardDrapkin picture EdwardDrapkin  Â·  4Comments