Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Roka20012 opened this issue Mar 17, 2023 · 0 comments

Comments

@Roka20012
Copy link

Roka20012 commented Mar 17, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant