Skip to content

[bug] extraScrollHeight is not calculated automatically for View's under KeyboardAwareScrollView #566

@Roka20012

Description

@Roka20012

Issue:

Basically, when some View is under KeyboardAwareScrollView, the KeyboardAwareScrollView scroll Input up exactly like the height of View here is a video example

Screen.Recording.2023-03-17.at.19.04.21.mov

Pseudocode example:

<>
 <KeyboardAwareScrollViewContainer
        // https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/418#issuecomment-617474009
        keyboardOpeningTime={Number.MAX_SAFE_INTEGER}
      >
        <View>
         <Text>Hello</Text>
          <Input />
           {/*... a lot of inputs */}
        </View>
</KeyboardAwareScrollViewContainer>
<View  style={{ height: 100 }}/> 
</>

Expected behavior: KeyboardAwareScrollView scroll Input without extra scrolling Input up

Current workaround: use onLayout on View under KeyboardAwareScrollView

const [extraScrollHeight, setExtraScrollHeight] = useState(0)
...

<>
 <KeyboardAwareScrollViewContainer
       extraScrollHeight={-extraScrollHeight}
        // https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/418#issuecomment-617474009
        keyboardOpeningTime={Number.MAX_SAFE_INTEGER}
      >
        <View>
         <Text>Hello</Text>
          <Input />
           {/*... a lot of inputs */}
        </View>
</KeyboardAwareScrollViewContainer>
<View onLayout={e => setExtraScrollHeight(e.nativeEvent.layout.height)}  style={{ height: 100 }}/> 
</>

WITH WORKAROUND:

Screen.Recording.2023-03-17.at.19.13.03.mov

UPD: I believe this PR should fix this issue - #426

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions