Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Dec 6, 2016
1 parent f5c282b commit 2bfa20e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Libraries/Components/ScrollView/ScrollViewStickyHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

const Animated = require('Animated');
const React = require('React');
const UIManager = require('UIManager');
const StyleSheet = require('StyleSheet');

const findNodeHandle = require('findNodeHandle');

type Props = {
children?: React.Element<*>,
scrollAnimatedValue: Animated.Value,
Expand Down Expand Up @@ -47,11 +50,14 @@ class ScrollViewStickyHeader extends React.Component {

let translateY;
if (measured) {
const inputRange = [-1, layoutY, layoutY + 1];
const outputRange: Array<number> = [0, 0, 1];
const inputRange = [-1, layoutY];
const outputRange: Array<number> = [0, 0];
if (nextHeaderLayoutY != null) {
inputRange.push(nextHeaderLayoutY, nextHeaderLayoutY + 1);
outputRange.push(nextHeaderLayoutY, nextHeaderLayoutY);
outputRange.push(nextHeaderLayoutY - layoutY, nextHeaderLayoutY - layoutY);
} else {
inputRange.push(layoutY + 1);
outputRange.push(1);
}
translateY = this.props.scrollAnimatedValue.interpolate({
inputRange,
Expand All @@ -65,6 +71,7 @@ class ScrollViewStickyHeader extends React.Component {

return (
<Animated.View
collapsable={false}
onLayout={this._onLayout}
style={[child.props.style, styles.header, {transform: [{translateY}]}]}>
{React.cloneElement(child, {
Expand Down

0 comments on commit 2bfa20e

Please sign in to comment.