diff --git a/index.d.ts b/index.d.ts index bf03b26..5cbb3bf 100644 --- a/index.d.ts +++ b/index.d.ts @@ -145,13 +145,13 @@ interface KeyboardAwareProps { interface KeyboardAwareScrollViewProps extends KeyboardAwareProps, - ScrollViewProps {} + ScrollViewProps { } interface KeyboardAwareFlatListProps extends KeyboardAwareProps, - FlatListProps {} + FlatListProps { } interface KeyboardAwareSectionListProps extends KeyboardAwareProps, - SectionListProps {} + SectionListProps { } interface KeyboardAwareState { keyboardSpace: number @@ -167,18 +167,19 @@ declare class ScrollableComponent extends React.Component { extraHeight?: number, keyboardOpeningTime?: number ) => void + flashScrollIndicators: () => void } -export class KeyboardAwareMixin {} +export class KeyboardAwareMixin { } export class KeyboardAwareScrollView extends ScrollableComponent< KeyboardAwareScrollViewProps, KeyboardAwareState -> {} +> { } export class KeyboardAwareFlatList extends ScrollableComponent< KeyboardAwareFlatListProps, KeyboardAwareState -> {} +> { } export class KeyboardAwareSectionList extends ScrollableComponent< KeyboardAwareSectionListProps, KeyboardAwareState -> {} +> { } diff --git a/lib/KeyboardAwareHOC.js b/lib/KeyboardAwareHOC.js index 03f46af..05fa46f 100644 --- a/lib/KeyboardAwareHOC.js +++ b/lib/KeyboardAwareHOC.js @@ -303,6 +303,16 @@ function KeyboardAwareHOC( this.scrollToPosition(0, this.position.y + extraHeight, true) } + flashScrollIndicators = () => { + const responder = this.getScrollResponder() + if (!responder) { + return + } + if (responder.flashScrollIndicators) { + responder.flashScrollIndicators() + } + } + /** * @param keyboardOpeningTime: takes a different keyboardOpeningTime in consideration. * @param extraHeight: takes an extra height in consideration. @@ -389,7 +399,7 @@ function KeyboardAwareHOC( keyboardSpace -= _KAM_DEFAULT_TAB_BAR_HEIGHT } this.setState({ keyboardSpace }) - const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField() + const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField() const responder = this.getScrollResponder() if (!currentlyFocusedField || !responder) { return @@ -434,7 +444,7 @@ function KeyboardAwareHOC( ) { this.scrollForExtraHeightOnAndroid( totalExtraHeight - - (keyboardPosition - textInputBottomPosition) + (keyboardPosition - textInputBottomPosition) ) } } @@ -512,7 +522,7 @@ function KeyboardAwareHOC( } update = () => { - const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField() + const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField() const responder = this.getScrollResponder() if (!currentlyFocusedField || !responder) { diff --git a/lib/KeyboardAwareInterface.js b/lib/KeyboardAwareInterface.js index 20fbcb4..4c23a87 100644 --- a/lib/KeyboardAwareInterface.js +++ b/lib/KeyboardAwareInterface.js @@ -10,4 +10,5 @@ export interface KeyboardAwareInterface { extraHeight: number, keyboardOpeningTime: number ) => void + flashScrollIndicators: () => void }