react-native-keyboard-aware-scroll-view icon indicating copy to clipboard operation
react-native-keyboard-aware-scroll-view copied to clipboard

Wrong content scrolling with scrollview child

Open lightman73 opened this issue 6 years ago • 15 comments

Hello, I've got a problem with an app I'm developing for a client. The structure of the page is like this:

<KeyboardAwareScrollView>
    <View>
        <ScrollView>
            <View> 
                <TextInput />
            </View>
            ...
            <View> 
                <TextInput />
            </View>
        </ScrollView>
    </View>
</KeyboardAwareScrollView>

As long as the focused TextInput is at the top of the ScrollView, everything's fine, but as you focus on TextInputs further down the ScrollView, RNKASV scrolls the content up way too much, to the point of having the focused TextInput outside view, as you can see in the attached screenshots.

Please note that I'm using react-native-navigation, and the page is inside a TabNavigator, inside a StackNavigator, inside a TabNavigator (don't ask, please; I already tried to explain the client that having a status bar, and two tabbars on the same page will be confusing for the user, but they're not listening...) (the StackNavigator contains only the inner TabNavigator, and it's there only to have the status bar at the top).

I'm using :

  • RNKASV 0.5.0 (latest version)
  • React 16.3.1
  • React-native 0.55.4

Any help will be greatly appreciated...

Thanks !

screen shot 2018-06-13 at 15 18 06 screen shot 2018-06-13 at 15 18 22 screen shot 2018-06-13 at 15 18 55 screen shot 2018-06-13 at 15 19 11 screen shot 2018-06-13 at 15 19 29 screen shot 2018-06-13 at 15 19 46

lightman73 avatar Jun 13 '18 13:06 lightman73

Hi, have you fixed this? thanks.

dhcmega avatar Jun 29 '18 02:06 dhcmega

@dhcmega

Nope, still waiting for an answer to this issue...

I fear I will have to find an alternative to RNKASV... :/

lightman73 avatar Jul 13 '18 13:07 lightman73

Hi @lightman73

Have you tried to test this in a real device?

alvaromb avatar Jul 13 '18 13:07 alvaromb

@alvaromb

Hello, yes, tried it on an iPhone 6s with iOS 11.2.6, and iPhone 7 with iOS 11.0.3, same behaviour...

lightman73 avatar Jul 13 '18 14:07 lightman73

Thanks @lightman73

We're in the middle of a super important release, I promise I'll check this out next Tuesday. We're super limited on resources right now.

Also, any other hint or even a PR will be highly appreciated.

alvaromb avatar Jul 13 '18 14:07 alvaromb

@alvaromb

Thanks ! If I get some other insight on the issue I'll let you know :)

lightman73 avatar Jul 13 '18 14:07 lightman73

@alvaromb

Hi, I just tried 0.7.0, and it's still showing the same behaviour. Did you find the time to have a look at the issue ?

Thanks again !

lightman73 avatar Aug 22 '18 08:08 lightman73

One question @lightman73, why the extra ScrollView inside KeyboardAwareScrollView?

alvaromb avatar Aug 22 '18 15:08 alvaromb

have same problem ;( Is there any news?

MXLI88 avatar Aug 29 '18 09:08 MXLI88

Facing the same problem. Any updates, @alvaromb?

bakesi avatar Oct 09 '18 11:10 bakesi

Facing same problem, Problem occur in TabNavigator

ThienMD avatar Oct 17 '18 04:10 ThienMD

Facing the exact same problem too. Whenever I tap on an input that is outside of the "original" viewport, it scrolls way too much. The inputs at the top of the form are fine though.

fabiendeborde avatar Oct 26 '18 07:10 fabiendeborde

For all of you facing this issue: Just remove the scrollView component inside "keyboardAwareScrollView", as it is a scrollView itself and can get scrollView props. scrollView inside a scrollView is never a good thing to handle :)

Nirony avatar Feb 14 '19 07:02 Nirony

What @Nirony said is a good lead. But if you still need 2 scrollView, I think that the behaviour you are seeing @lightman73 is that the 2 scrollView are pushing the content to the top for the keyboard space, and one is too much. There is a prop viewIsInsideTabBar you can set at true for KeyboardAwareScrollView which inside his code set keyboardspace to 0. Maybe this can work, feel free to make a feedback.

Drakoun avatar Feb 26 '19 11:02 Drakoun

Any updates on this issue? I am facing the same.

valeriashpiner avatar Apr 06 '21 18:04 valeriashpiner