Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Jan 19, 2017
1 parent 48c5e09 commit 26e8c5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 13 additions & 3 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,18 @@ const ScrollView = React.createClass({

mixins: [ScrollResponder.Mixin],

_scrollAnimatedValue: new Animated.Value(0),
_scrollAnimatedValueAttachment: null,
_stickyHeaderRefs: new Map(),
_scrollAnimatedValue: (null: ?Animated.Value),
_scrollAnimatedValueAttachment: (null: ?{detach: () => void}),
_stickyHeaderRefs: (new Map(): Map<number, ScrollViewStickyHeader>),

getInitialState: function() {
return this.scrollResponderMixinGetInitialState();
},

componentWillMount: function() {
this._scrollAnimatedValue = new Animated.Value(0);
},

componentDidMount: function() {
this._updateAnimatedNodeAttachment();
},
Expand All @@ -371,6 +375,12 @@ const ScrollView = React.createClass({
this._updateAnimatedNodeAttachment();
},

componentWillUnmount: function() {
if (this._scrollAnimatedValueAttachment) {
this._scrollAnimatedValueAttachment.detach();
}
},

setNativeProps: function(props: Object) {
this._scrollViewRef && this._scrollViewRef.setNativeProps(props);
},
Expand Down
7 changes: 2 additions & 5 deletions Libraries/Components/ScrollView/ScrollViewStickyHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@

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 @@ -50,8 +47,8 @@ class ScrollViewStickyHeader extends React.Component {

let translateY;
if (measured) {
const inputRange = [-1, layoutY];
const outputRange: Array<number> = [0, 0];
const inputRange = [-1, 0, layoutY];
const outputRange: Array<number> = [-1, 0, 0];
if (nextHeaderLayoutY != null) {
inputRange.push(nextHeaderLayoutY, nextHeaderLayoutY + 1);
outputRange.push(nextHeaderLayoutY - layoutY, nextHeaderLayoutY - layoutY);
Expand Down

0 comments on commit 26e8c5a

Please sign in to comment.