From 174753600778675c8b0e7d341b6044192af68d00 Mon Sep 17 00:00:00 2001 From: Kacie Bawiec Date: Thu, 15 Apr 2021 12:39:38 -0700 Subject: [PATCH] Clean up the initialization of instance variables in ScrollView Summary: This is a small cleanup to move initialization out of the `constructor` as it is unnecessary, and it is currently double initializing a few values. Changelog: [General][Changed] Clean up the initialization of instance variables in ScrollView Reviewed By: nadiia Differential Revision: D27631320 fbshipit-source-id: 762277e4993a9ce86d444ff2d9e845c93e94d1a8 --- Libraries/Components/ScrollView/ScrollView.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index b924d2c854d..8eca425604d 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -705,6 +705,7 @@ type ScrollViewComponentStatics = $ReadOnly<{| */ class ScrollView extends React.Component { static Context: typeof ScrollViewContext = ScrollViewContext; + constructor(props: Props) { super(props); @@ -712,13 +713,9 @@ class ScrollView extends React.Component { this.props.contentOffset?.y ?? 0, ); this._scrollAnimatedValue.setOffset(this.props.contentInset?.top ?? 0); - this._stickyHeaderRefs = new Map(); - this._headerLayoutYs = new Map(); } - _scrollAnimatedValue: AnimatedImplementation.Value = new AnimatedImplementation.Value( - 0, - ); + _scrollAnimatedValue: AnimatedImplementation.Value; _scrollAnimatedValueAttachment: ?{detach: () => void, ...} = null; _stickyHeaderRefs: Map< string,