Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Scrollview scrolls up on focus #55

Closed
woodpav opened this issue May 26, 2019 · 7 comments
Closed

Scrollview scrolls up on focus #55

woodpav opened this issue May 26, 2019 · 7 comments

Comments

@woodpav
Copy link

woodpav commented May 26, 2019

On both Android and iOS the keyboard scrolls up when I focus on an input.

My view is roughly

<View style={{ flex: 1 }}>
   <ScrollView style={{ flex: 1 }}>
     <View style={{ height: 1000 }} />
     <TextInput />
   </ScrollView>
   <View style={{ height: 100 }} />
</View>

Do I need to mess around with offset props or do I need to build a demo? Great repo btw, thank you.

@baijunjie
Copy link
Owner

Please use https://snack.expo.io/ to make the smallest demo.

@woodpav
Copy link
Author

woodpav commented May 28, 2019

Here is a snack: https://snack.expo.io/SJbdHEjp4 and here is a repo to clone: https://github.com/woodpav/keyboard-test

The snack behaves as expected but when you clone the repo and put it onto the simulator it does work.

Sometimes the view changes to the right size but most of the time the TextInput moves down and hides below the keyboard.

@baijunjie
Copy link
Owner

I didn't find anything unusual, maybe I didn't understand what you meant.
Will Android and iOS have the same problem?

@baijunjie
Copy link
Owner

On android devices, you may need to add them manually:

<InputScrollView keyboardAvoidingViewProps={{ behavior: "padding" }}>
...

@woodpav
Copy link
Author

woodpav commented May 29, 2019

I am experiencing it on iOS and Android simulators and physical devices. It happens after refreshing the app.

To reproduce:

  1. git clone https://github.com/woodpav/keyboard-test
  2. cd keyboard-test && yarn ios
  3. Scroll down and click "Hi" placeholder
  4. Refresh app and repeat step 3. The "Hi" TextInput will move below the keyboard instead of moving above the keyboard like it should. This is the bug.

The GIF shows the keyboard avoiding working after the initial open then failing after the next two refreshes. In order to trigger the bug you need to refresh the app at least once.

Sorry GIF loop makes it a little confusing to follow.

keyboard-test

@baijunjie
Copy link
Owner

Unfortunately, I can't run your project.
In IOS, debug mode and release mode may have different effects. Is there the same problem in release mode?

@baijunjie
Copy link
Owner

@woodpav Please try v1.9.3

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

No branches or pull requests

2 participants