From c825e7f2a35b6ec2ee1e8fece5bc1c96d5880999 Mon Sep 17 00:00:00 2001 From: Enrico Balsamo Date: Thu, 15 Jun 2023 12:33:03 +0200 Subject: [PATCH] fix(types): export type for listenToKeyboardEvents and KeyboardAwareHOCOptions In this PR the types of `listenToKeyboardEvents` and `KeyboardAwareHOCOptions` are exported. --- index.d.ts | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index bf03b269..c6a90b95 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,7 +7,8 @@ import * as React from 'react' import { ScrollViewProps, FlatListProps, - SectionListProps + SectionListProps, + ViewProps } from 'react-native' interface KeyboardAwareProps { @@ -169,6 +170,11 @@ declare class ScrollableComponent extends React.Component { ) => void } +export function listenToKeyboardEvents (options: any): ( + (ScrollableComponent: React$Component, userOptions?: KeyboardAwareHOCOptions = {}) => + typeof React.Component + ); + export class KeyboardAwareMixin {} export class KeyboardAwareScrollView extends ScrollableComponent< KeyboardAwareScrollViewProps, @@ -182,3 +188,44 @@ export class KeyboardAwareSectionList extends ScrollableComponent< KeyboardAwareSectionListProps, KeyboardAwareState > {} + +export type KeyboardAwareHOCOptions = ?{ + enableOnAndroid: boolean, + contentContainerStyle: ?Object, + enableAutomaticScroll: boolean, + extraHeight: number, + extraScrollHeight: number, + enableResetScrollToCoords: boolean, + keyboardOpeningTime: number, + viewIsInsideTabBar: boolean, + refPropName: string, + extractNativeRef: Function +} + +export type KeyboardAwareHOCProps = ScrollViewProps & { + viewIsInsideTabBar?: boolean, + resetScrollToCoords?: { + x: number, + y: number + }, + enableResetScrollToCoords?: boolean, + enableAutomaticScroll?: boolean, + extraHeight?: number, + extraScrollHeight?: number, + keyboardOpeningTime?: number, + onScroll?: Function, + update?: Function, + contentContainerStyle?: any, + enableOnAndroid?: boolean, + innerRef?: Function, + onKeyboardWillShow?: Function, + onKeyboardDidShow?: Function, + onKeyboardWillHide?: Function, + onKeyboardDidHide?: Function, + onKeyboardWillChangeFrame?: Function, + onKeyboardDidChangeFrame?: Function, +} + +export type KeyboardAwareHOCState = { + keyboardSpace: number +}