wix-incubator / react-native-keyboard-input

Use your own custom input component instead of the system keyboard
MIT License
819 stars 150 forks source link

Keyboard behavior changed to 'position' #5

Closed thorbenandresen closed 7 years ago

thorbenandresen commented 7 years ago

Hi @artald, thanks so much for all the fixes & enhancement, this is really great stuff!

After I installed the latest version (3.0.2) I discovered that the keyboard behavior changed to 'position'. By 'position' I mean that the the underlying view is pushed up when the keyboard appears, while before it was just overlaying the view.

The problem is that I need to implement the keyboardavoidingview with the behavior 'padding', i.e. 'position' behavior is breaking my layout.

Can we make the keyboard behavior a prop?

thorbenandresen commented 7 years ago

Ok, found that there already is prop for that :) => iOSScrollBehavior

artald commented 7 years ago

hey @Thorbenandresen I recommend that for a starter you install version 3.0.3, has some additional fixes too..

The scroll behavior can be controlled via a prop. The "fixed offset" is indeed the default which I think most chat-like screen would want.

The options are the "fixed offset", "scroll to bottom" and "none". Controlling it is not very pretty, maybe we can improve it in the future, you need to currently use exported native constants:

import {NativeModules} from 'react-native';
//options are:
NativeModules.KeyboardTrackingViewManager.KeyboardTrackingScrollBehaviorNone
NativeModules.KeyboardTrackingViewManager.KeyboardTrackingScrollBehaviorFixedOffset
NativeModules.KeyboardTrackingViewManager.KeyboardTrackingScrollBehaviorFixedOffset
//usage
<KeyboardAccessoryView
iOSScrollBehavior={scrollBehavior}
/>

oh, I see you found it... :)