RN: Remove Animated -> ScrollView -> Animated Cycle

Reviewed By: sahrens

Differential Revision: D7027223

fbshipit-source-id: 59924fada0f29a5e2ce1ae9a3694a94cfb26367c
This commit is contained in:
Tim Yung
2018-02-20 20:13:22 -08:00
committed by Facebook Github Bot
parent ad06403c3e
commit 8c036ce090
4 changed files with 22 additions and 23 deletions

View File

@@ -9,7 +9,7 @@
*/
'use strict';
const Animated = require('Animated');
const AnimatedImplementation = require('AnimatedImplementation');
const ColorPropType = require('ColorPropType');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const Platform = require('Platform');
@@ -497,7 +497,7 @@ const ScrollView = createReactClass({
mixins: [ScrollResponder.Mixin],
_scrollAnimatedValue: (new Animated.Value(0): Animated.Value),
_scrollAnimatedValue: (new AnimatedImplementation.Value(0): AnimatedImplementation.Value),
_scrollAnimatedValueAttachment: (null: ?{detach: () => void}),
_stickyHeaderRefs: (new Map(): Map<number, ScrollViewStickyHeader>),
_headerLayoutYs: (new Map(): Map<string, number>),
@@ -509,7 +509,7 @@ const ScrollView = createReactClass({
},
UNSAFE_componentWillMount: function() {
this._scrollAnimatedValue = new Animated.Value(this.props.contentOffset ? this.props.contentOffset.y : 0);
this._scrollAnimatedValue = new AnimatedImplementation.Value(this.props.contentOffset ? this.props.contentOffset.y : 0);
this._scrollAnimatedValue.setOffset(this.props.contentInset ? this.props.contentInset.top : 0);
this._stickyHeaderRefs = new Map();
this._headerLayoutYs = new Map();
@@ -623,7 +623,7 @@ const ScrollView = createReactClass({
this._scrollAnimatedValueAttachment.detach();
}
if (this.props.stickyHeaderIndices && this.props.stickyHeaderIndices.length > 0) {
this._scrollAnimatedValueAttachment = Animated.attachNativeEvent(
this._scrollAnimatedValueAttachment = AnimatedImplementation.attachNativeEvent(
this._scrollViewRef,
'onScroll',
[{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}]