<commit_before>// @flow

import * as React from 'react';
import { View, ScrollView } from 'react-native';

type Props = {|
  +shouldScrollIntoView: boolean,
  +scrollToY?: (y: number) => void,
  +children: React.Node,
|};

type OnLayoutEvent = {|
  +nativeEvent: {
    +layout: { +x: number, +y: number, +width: number, +height: number },
  },
|};

export class ScrollIntoView extends React.Component<Props> {
  onLayout = (e: OnLayoutEvent) => {
    this.props.scrollToY && this.props.scrollToY(e.nativeEvent.layout.y);
  };
  render() {
    return (
      <View onLayout={this.props.shouldScrollIntoView && this.onLayout}>
        {this.props.children}
      </View>
    );
  }
}

type ScrollViewWithScrollToYProps = {|
  +children: React.Node,
|};

export class ScrollViewWithScrollToY extends React.Component<
  ScrollViewWithScrollToYProps,
> {
  scrollView: ?ScrollView;
<commit_msg>Fixing prop type being passed to prop onLayout in View component (#867)<commit_after>// @flow

import * as React from 'react';
import { View, ScrollView } from 'react-native';

type Props = {|
  +shouldScrollIntoView: boolean,
  +scrollToY?: (y: number) => void,
  +children: React.Node,
|};

type OnLayoutEvent = {|
  +nativeEvent: {
    +layout: { +x: number, +y: number, +width: number, +height: number },
  },
|};

export class ScrollIntoView extends React.Component<Props> {
  onLayout = (e: OnLayoutEvent) => {
    this.props.scrollToY && this.props.scrollToY(e.nativeEvent.layout.y);
  };
  render() {
    const onLayout = this.props.shouldScrollIntoView ? this.onLayout : null;
    return <View onLayout={onLayout}>{this.props.children}</View>;
  }
}

type ScrollViewWithScrollToYProps = {|
  +children: React.Node,
|};

export class ScrollViewWithScrollToY extends React.Component<
  ScrollViewWithScrollToYProps,
> {
  scrollView: ?ScrollView;

{'fraction_non_alphanumeric': 0.14704286489419424, 'fraction_numerical': 0.0016277807921866521, 'mean_word_length': 4.209039548022599, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1872694', 'n_tokens_mistral': 633, 'n_tokens_neox': 619, 'n_words': 139}