react-native-keyboard-spacer icon indicating copy to clipboard operation
react-native-keyboard-spacer copied to clipboard

KeyboardSpacer does not work properly with react navigation tab bar

Open mikechambers610 opened this issue 6 years ago • 8 comments

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.

mikechambers610 avatar Jun 13 '18 20:06 mikechambers610

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

arthurCalv avatar Jun 14 '18 16:06 arthurCalv

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

<KeyboardSpacer topSpacing={-50}/>

pulpdood avatar Jun 18 '18 10:06 pulpdood

Thanks pulpdood I will give it a shot and see how it works.

On Mon, Jun 18, 2018 at 6:26 AM, pulpdood [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Andr3wHur5t/react-native-keyboard-spacer/issues/72#issuecomment-398010665, or mute the thread https://github.com/notifications/unsubscribe-auth/AQxEqqWt6Um_sXVxzr2gozztJDFUdwekks5t94BkgaJpZM4Um6o9 .

mikechambers610 avatar Jun 18 '18 17:06 mikechambers610

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.

hieunc229 avatar Jun 24 '18 01:06 hieunc229

@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

dextermb avatar Sep 12 '18 08:09 dextermb

Yet another solution:

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

ESA2012 avatar Mar 04 '19 15:03 ESA2012

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"

CyxouD avatar Dec 13 '19 17:12 CyxouD

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()} />

alansp avatar Nov 10 '21 06:11 alansp