Andr3wHur5t / react-native-keyboard-spacer

Plug and play react-native keyboard spacer view.
MIT License
1.56k stars 219 forks source link

Doesn't take into account auto-correct bar on android #18

Closed npomfret closed 8 years ago

npomfret commented 8 years ago

Thanks for this component, very nice.

I'm using it to do some positioning of a absolute element in android. There's a auto correct bar on the top of the keyboard which doesn't seem to be accounted for in the Y direction. The result is that my component appears slightly under the keyboard. Any idea how to find out the height of the auto correct bar?

Andr3wHur5t commented 8 years ago

You should be able to use the topSpacing attribute to account for the auto correct bar.

I haven't actually tested this module with android, nor used react-native with android yet so I can't advise on how to get the auto correct bar height.

I would look on stack overflow for answers, if you do get it working PRs are always welcome

npomfret commented 8 years ago

Can't quite work it out, but no big deal. Thanks anyway

SudoPlz commented 8 years ago

I've got the same problem, Android is important, but I cannot figure how to connect this SO answer: http://stackoverflow.com/questions/13534365/getting-the-dimensions-of-the-soft-keyboard on how to get soft keyboard size to this library.

Andr3wHur5t commented 8 years ago

@SudoPlz Using that answer you would need to write some android native code, then link the getHeight API to react-native so its exposed as a javascript API.

Once you've done that you can hook into onToggle on this component where you would set topSpacing to the difference of the component height and what is returned by the exposed getHeight API.

It's definitely not an ideal solution; the new keyboard module in v0.3.0 of this module may handle this as well I'd check that first before going through all that work.

I'll try and get my hands on an android device so I can solve this problem in a simplistic way.