Skip to content

Commit 8a49b1c

Browse files
VincentLangletalvaromb
authored andcommitted
Update typing for typescript (#242)
1 parent 68a126c commit 8a49b1c

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

index.d.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// TypeScript Version: 2.3.2
55

66
import * as React from 'react'
7-
import { ScrollViewProperties, ListViewProperties, FlatListProperties } from 'react-native'
7+
import { ScrollViewProperties, ListViewProperties, FlatListProperties, SectionListProperties } from 'react-native'
88

99
interface KeyboardAwareProps {
1010
/**
@@ -98,21 +98,40 @@ interface KeyboardAwareScrollViewProps
9898
interface KeyboardAwareFlatListProps<ItemT>
9999
extends KeyboardAwareProps,
100100
FlatListProperties<ItemT> {}
101+
interface KeyboardAwareSectionListProps<ItemT>
102+
extends KeyboardAwareProps,
103+
SectionListProperties<ItemT> {}
101104

102105
interface KeyboardAwareState {
103106
keyboardSpace: number
104107
}
105108

109+
declare class ScrollableComponent<P, S> extends React.Component<P, S> {
110+
getScrollResponder: () => void;
111+
scrollToPosition: (x: number, y: number, animated?: boolean) => void;
112+
scrollToEnd: (animated?: boolean) => void;
113+
scrollForExtraHeightOnAndroid: (extraHeight: number) => void;
114+
scrollToFocusedInput: (
115+
reactNode: Object,
116+
extraHeight: number,
117+
keyboardOpeningTime: number
118+
) => void
119+
}
120+
106121
export class KeyboardAwareMixin {}
107-
export class KeyboardAwareListView extends React.Component<
122+
export class KeyboardAwareListView extends ScrollableComponent<
108123
KeyboardAwareListViewProps,
109124
KeyboardAwareState
110-
> {}
111-
export class KeyboardAwareScrollView extends React.Component<
125+
> {}
126+
export class KeyboardAwareScrollView extends ScrollableComponent<
112127
KeyboardAwareScrollViewProps,
113128
KeyboardAwareState
114-
> {}
115-
export class KeyboardAwareFlatList extends React.Component<
116-
KeyboardAwareFlatListProps<any>,
117-
KeyboardAwareState
118-
> {}
129+
> {}
130+
export class KeyboardAwareFlatList extends ScrollableComponent<
131+
KeyboardAwareFlatListProps<any>,
132+
KeyboardAwareState
133+
> {}
134+
export class KeyboardAwareSectionList extends ScrollableComponent<
135+
KeyboardAwareSectionListProps<any>,
136+
KeyboardAwareState
137+
> {}

0 commit comments

Comments
 (0)