UNPKG

1.62 kBTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10import type * as React from 'react';
11import {Constructor} from '../../../types/private/Utilities';
12import {TimerMixin} from '../../../types/private/TimerMixin';
13import {StyleProp} from '../../StyleSheet/StyleSheet';
14import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
15import {ViewProps} from '../View/ViewPropTypes';
16
17/**
18 * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
19 * It can automatically adjust either its position or bottom padding based on the position of the keyboard.
20 */
21declare class KeyboardAvoidingViewComponent extends React.Component<KeyboardAvoidingViewProps> {}
22declare const KeyboardAvoidingViewBase: Constructor<TimerMixin> &
23 typeof KeyboardAvoidingViewComponent;
24export class KeyboardAvoidingView extends KeyboardAvoidingViewBase {}
25
26export interface KeyboardAvoidingViewProps extends ViewProps {
27 behavior?: 'height' | 'position' | 'padding' | undefined;
28
29 /**
30 * The style of the content container(View) when behavior is 'position'.
31 */
32 contentContainerStyle?: StyleProp<ViewStyle> | undefined;
33
34 /**
35 * This is the distance between the top of the user screen and the react native view,
36 * may be non-zero in some use cases.
37 */
38 keyboardVerticalOffset?: number | undefined;
39
40 /**
41 * Enables or disables the KeyboardAvoidingView.
42 *
43 * Default is true
44 */
45 enabled?: boolean | undefined;
46}