Fork me on GitHub
#cljsrn
<
2016-03-23
>
jessica06:03:14

What’s the best way to move a view up/down with the showing/hiding of a keyboard, in a reagent/re-frame project? (Imagine a simple chat UI where the keyboard ends up covering the input-text view when it’s shown.) I’ve seen a couple js examples where they listen to lifecycle events and attach keyboardWillShow and keyboardWillHide events, and set a state to update the view size accordingly. Is there a more straightforward way to do so without mucking with lifecycle methods?

jessica06:03:26

Looking through the re-frame wiki (https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-3-a-class-with-life-cycle-methods), it mentions that you’d probably use Form-3 less than 1% of the time… Is this situation part of the 1%?

jellea07:03:44

@jessica: there's a nice drop in js package for keyboard spacing. Let me check on my laptop...

jellea07:03:24

But if you want to have more control over it you would have to use the lifecycle methods yes

jellea18:03:28

@jessica: sorry, forgot to actually send it from my laptop. try this: https://github.com/Andr3wHur5t/react-native-keyboard-spacer

jessica20:03:04

Thanks @jellea! I ended up just going with the lifecycle method route.