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
This commit is contained in:
Kacie Bawiec
2021-04-15 12:41:48 -07:00
committed by Facebook GitHub Bot
parent bd1d4e9f4f
commit 1747536007
@@ -705,6 +705,7 @@ type ScrollViewComponentStatics = $ReadOnly<{|
*/
class ScrollView extends React.Component<Props, State> {
static Context: typeof ScrollViewContext = ScrollViewContext;
constructor(props: Props) {
super(props);
@@ -712,13 +713,9 @@ class ScrollView extends React.Component<Props, State> {
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,