react-native-keyboard-aware-scroll-view: extraHeight and extraScrollHeight not working on React Native 0.56

Hello,

I had this library working with a RN 0.55 project, and I’ve recently upgraded the project to RN 0.56. At that point extraHeight suddenly stopped working, and I can’t figure out why. I know there have been subtle changes to ScrollView in RN 0.56, but I don’t know whether or not they’re affecting the library.

I also tried extraScrollHeight, which seems to work on iOS, but not Android with RN 0.56.

You just don’t get any extra space with extraHeight on either platform, and you only get extra space with extraScrollHeight on iOS.

Here’s a minimal project that demos the problem behaviour:

https://github.com/ashour/KeyboardAwareScrollViewRN56Demo

Here’s the relevant code as well:

import React, {Component} from 'react';
import {TextInput, StyleSheet, Text, View} from 'react-native';

import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';

export default class App extends Component {
    render() {
        return (
            <View style={styles.container}>
                <KeyboardAwareScrollView
                    enableOnAndroid

                    // Doesn't work on RN 0.56 for either Android or iOS
                    extraHeight={200}

                    // Works on iOS but not Android in RN 0.56
                    extraScrollHeight={200}

                    style={styles.keyboardAwareScrollView}
                    contentContainerStyle={styles.contentContainer}
                >
                    <Text style={styles.label}>Enter your name</Text>
                    <TextInput style={styles.input}/>
                </KeyboardAwareScrollView>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'flex-end',
        backgroundColor: '#F5FCFF',
    },
    keyboardAwareScrollView: {
        flex: 1,
        borderColor: 'red',
        borderWidth: 1,
    },
    contentContainer: {
        borderColor: 'blue',
        borderWidth: 1,
    },
    label: {
        marginTop: 400,
        fontSize: 20,
        margin: 10,
    },
    input: {
        width: '100%',
        height: 44,
        backgroundColor: '#eee',
        borderColor: '#333',
        borderWidth: 1,
    },
});

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 21

Most upvoted comments

I’m having the same issue extraScrollHeight works on iOS but not on Android, extraHeight doesn’t seem to do anything on either. Has anyone managed to resolve this?

For me extraHeight - doesn’t work on IOS but works on ANDROID extraScrollHeight - works on IOS but doesn’t work on ANDROID

Well, it seems that props scrollEnabled={true} enableAutomaticScroll={true}> are now mandatory

Can someone confirm that this is working from 0.57.2? I’m on 0.57.3 and can’t make this to work.

Thank you @nikoremi97 😃 “Well, it seems that props scrollEnabled={true} enableAutomaticScroll={true}> are now mandatory”

this works like a magic ❤️

I can’t seem to get extraScrollHeight to work even on iOS with RN 0.59.9

 <KeyboardAwareScrollView
        scrollEnabled={true}
        enableAutomaticScroll={true}
        extraScrollHeight={100}
        contentContainerStyle={styles.superContainer}
      >