Skip to content

Commit 78419d3

Browse files
author
Joshua Jahans
committed
add bottomOffset prop to triggeringview
1 parent 226fdd0 commit 78419d3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/TriggeringView.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Props = {
1212
onTouchBottom: Function,
1313
children?: React$Node,
1414
onLayout?: Function,
15+
bottomOffset?: number,
1516
};
1617

1718
type DefaultProps = {
@@ -21,6 +22,7 @@ type DefaultProps = {
2122
onDisplay: Function,
2223
onTouchTop: Function,
2324
onTouchBottom: Function,
25+
bottomOffset: number,
2426
};
2527

2628
type State = {
@@ -30,7 +32,7 @@ type State = {
3032

3133
type Context = {
3234
scrollPageY?: number,
33-
scrollY: Animated.Value,
35+
scrollY: typeof Animated.Value,
3436
};
3537

3638
class TriggeringView extends Component<Props, State> {
@@ -55,6 +57,7 @@ class TriggeringView extends Component<Props, State> {
5557
onDisplay: () => {},
5658
onTouchTop: () => {},
5759
onTouchBottom: () => {},
60+
bottomOffset: 0,
5861
};
5962

6063
constructor(props: Props) {
@@ -114,11 +117,11 @@ class TriggeringView extends Component<Props, State> {
114117
this.props.onTouchTop(false);
115118
}
116119

117-
if (!this.state.hidden && value >= bottom) {
120+
if (!this.state.hidden && value >= bottom + this.props.bottomOffset) {
118121
this.setState({ hidden: true });
119122
this.props.onHide();
120123
this.props.onTouchBottom(true);
121-
} else if (this.state.hidden && value < bottom) {
124+
} else if (this.state.hidden && value < bottom + this.props.bottomOffset) {
122125
this.setState({ hidden: false });
123126
this.props.onBeginDisplayed();
124127
this.props.onTouchBottom(false);

0 commit comments

Comments
 (0)