KeyboardAvoidingView misplaces absolutely positioned elements
See original GitHub issueDescription
Having an element with position: absolute
in a KeyboardAvoidingView
with behavior="padding
and keyboardVerticalOffset
greater than 0
, moves the element permanently (even after closing the keyboard).
React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
Memory: 727.96 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
Yarn: 1.21.1 - ~/.yarn/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.2, 26.0.1, 27.0.3, 28.0.3
System Images: a...google_apis | Google APIs Intel x86 Atom Sys...
Android NDK: 17.0.4754217
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_102 - /usr/bin/javac
Python: 2.7.17 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Run app
- Tap on text input
- Close text input
Expected Results
After closing the keyboard the element should be at its original position.
Snack, code example, screenshot, or link to a repository:
link to snack: https://snack.expo.io/@vmark/keyboardavoiding-absolute-positioning-bug link to repo: https://github.com/vujevits/KeyboardAvoidingAbsoluteExample
Screenshots
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13
Top Results From Across the Web
Button wtih absolute position inside KeyboardAvoidingView ...
I have a button with absolute position, used for a form. When inside a KeyboardAvoidingView it goes on top of the other elements...
Read more >KeyboardAvoidingView not working properly? Check your ...
This is because Flexbox has default justifyContent as flex-start , which means items are positioned from the beginning(top) of the container ...
Read more >ReactNative How to keep the scroll view position when the ...
Coding example for the question ReactNative How to keep the scroll view position when the keyboard opened-React Native.
Read more >nested textinput on scrollview react native - You.com | The AI ...
Is there a way to keep the keyboard open even when input loses focus/prevent blur on ... height vs position vs padding in...
Read more >Tweets with replies by Fernando Rojo ... - Twitter
A collection of high-quality, unstyled components for creating beautiful emails. ... no. a much more important feature is css object-position, which native ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is total shit my friends! I can’t believe it’s still there!
Hello guys, I solved this by taking the ‘event’ and checking if the keyboard was ‘visible’ or ‘hidden’, put it in a state and did the logic.
and…
To be honest, I didn’t like the solution 100% because of the size of adding code for something so ‘simple’, but that’s what I did.