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

KeyboardSpacer does not work properly with react navigation tab bar #72

Open
mikechambers610 opened this issue Jun 13, 2018 · 8 comments

Comments

@mikechambers610
Copy link

When using the keyboard spacer it will push the textinput up an additional amount (additional amount = height of the tab bar) for both ios and android.

Works great if you aren't using a tab bar.... but most cases the developer likes to use the tab bars.

@arthurCalv
Copy link

Yeah having the same issue with a grey bar above the keyboard when using a tab bar
screen shot 2018-06-14 at 17 33 44

@pulpdood
Copy link

I added topSpacing={-50} and it seems to fix the issue:

<KeyboardSpacer topSpacing={-50}/>

@mikechambers610
Copy link
Author

mikechambers610 commented Jun 18, 2018 via email

@hieunc229
Copy link

I experienced the issue while applying into an 'absolute' or 'fixed' view. I could be caused by any issue, though I found out that while using 'absolute' or 'fixed' view, the calculation would be missed (similar to this described issue).

I came up with a different method that supports 'absolute', 'fixed' view and publish it on react-native-spacer.

@dextermb
Copy link

@pulpdood while this works on some devices, it does not seem to work on all. For example I still get bars on Pixel XL 2 and iPhone X when adding -55 on topSpacing

@ESA2012
Copy link

ESA2012 commented Mar 4, 2019

Yet another solution:

import { getBottomSpace } from 'react-native-iphone-x-helper';
...
<KeyboardSpacer topSpacing={-getBottomSpace()} />

@CyxouD
Copy link

CyxouD commented Dec 13, 2019

thanks for direction @ESA2012. For the case of iPhoneX + tab bar. I use:

import { getBottomSpace } from 'react-native-iphone-x-helper';
...
<KeyboardSpacer topSpacing={-(TAB_BAR_HEIGHT + getBottomSpace())} />

It looks like it is exact this value needed

My config:

"react-native": "0.59.10",
"react-navigation": "^3.0.5"

@alansp
Copy link

alansp commented Nov 10, 2021

I'm using this for iPhone only (don't have issues on Android), and this combo solved all my problems...

import { useBottomTabBarHeight } from '@react-navigation/bottom-tabs';

<KeyboardSpacer topSpacing={-useBottomTabBarHeight()} />

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

8 participants