react-native-keyboard-controller
Version:
Keyboard manager which works in identical way on both iOS and Android
41 lines (40 loc) • 1.46 kB
TypeScript
import React from "react";
import { View } from "react-native";
import type { ViewProps } from "react-native";
export type KeyboardAvoidingViewBaseProps = {
/**
* Controls whether this `KeyboardAvoidingView` instance should take effect.
* This is useful when more than one is on the screen. Defaults to true.
*/
enabled?: boolean;
/**
* Distance between the top of the user screen and the React Native view. This
* may be non-zero in some cases. Defaults to 0.
*/
keyboardVerticalOffset?: number;
} & ViewProps;
export type KeyboardAvoidingViewProps = KeyboardAvoidingViewBaseProps & ({
/**
* Specify how to react to the presence of the keyboard.
*/
behavior?: "position";
/**
* Style of the content container when `behavior` is 'position'.
*/
contentContainerStyle?: ViewProps["style"];
} | {
/**
* Specify how to react to the presence of the keyboard.
*/
behavior?: "height" | "padding" | "translate-with-padding";
/**
* `contentContainerStyle` is not allowed for these behaviors.
*/
contentContainerStyle?: never;
});
/**
* View that moves out of the way when the keyboard appears by automatically
* adjusting its height, position, or bottom padding.
*/
declare const KeyboardAvoidingView: React.ForwardRefExoticComponent<React.PropsWithChildren<KeyboardAvoidingViewProps> & React.RefAttributes<View>>;
export default KeyboardAvoidingView;