<commit_before>'use strict';

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FlatList, SectionList, Platform, ViewPropTypes } from 'react-native';

import SwipeRow from './SwipeRow';

/**
 * ListView that renders SwipeRows.
 */
class SwipeListView extends Component {
    constructor(props) {
        super(props);
        this._rows = {};
        this.openCellKey = null;
        this.listViewProps = {};
        if (Platform.OS === 'ios') {
            // Keep track of scroll offset and layout changes on iOS to be able to handle
            // https://github.com/jemise111/react-native-swipe-list-view/issues/109
            this.yScrollOffset = 0;
            this.layoutHeight = 0;
            this.listViewProps = {
                onLayout: e => this.onLayout(e),
                onContentSizeChange: (w, h) => this.onContentSizeChange(w, h),
            };
        }
    }

    componentDidUpdate(nextProps) {
        if (nextProps.refreshing) this.safeCloseOpenRow();
    }

    setScrollEnabled(enable) {
        if (this.props.scrollEnabled === false) {
            return;
        }
        // Due to multiple issues reported across different versions of RN
        // We do this in the safest way possible...
        if (this._listView && this._listView.setNativeProps) {
            this._listView.setNativeProps({ scrollEnabled: enable });
        } else if (this._listView && this._listView.getScrollResponder) {
            const scrollResponder = this._listView.getScrollResponder();
            scrollResponder.setNativeProps &&
                scrollResponder.setNativeProps({ scrollEnabled: enable });
        }
        this.props.onScrollEnabled && this.props.onScrollEnabled(enable);
    }

    safeCloseOpenRow() {
        const rowRef = this._rows[this.openCellKey];
        if (rowRef && rowRef.closeRow) {<commit_msg>Fixed componentDidUpdate to use this.props instead of obsolete nextProps<commit_after>'use strict';

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FlatList, SectionList, Platform, ViewPropTypes } from 'react-native';

import SwipeRow from './SwipeRow';

/**
 * ListView that renders SwipeRows.
 */
class SwipeListView extends Component {
    constructor(props) {
        super(props);
        this._rows = {};
        this.openCellKey = null;
        this.listViewProps = {};
        if (Platform.OS === 'ios') {
            // Keep track of scroll offset and layout changes on iOS to be able to handle
            // https://github.com/jemise111/react-native-swipe-list-view/issues/109
            this.yScrollOffset = 0;
            this.layoutHeight = 0;
            this.listViewProps = {
                onLayout: e => this.onLayout(e),
                onContentSizeChange: (w, h) => this.onContentSizeChange(w, h),
            };
        }
    }

    componentDidUpdate() {
        if (this.props.refreshing) this.safeCloseOpenRow();
    }

    setScrollEnabled(enable) {
        if (this.props.scrollEnabled === false) {
            return;
        }
        // Due to multiple issues reported across different versions of RN
        // We do this in the safest way possible...
        if (this._listView && this._listView.setNativeProps) {
            this._listView.setNativeProps({ scrollEnabled: enable });
        } else if (this._listView && this._listView.getScrollResponder) {
            const scrollResponder = this._listView.getScrollResponder();
            scrollResponder.setNativeProps &&
                scrollResponder.setNativeProps({ scrollEnabled: enable });
        }
        this.props.onScrollEnabled && this.props.onScrollEnabled(enable);
    }

    safeCloseOpenRow() {
        const rowRef = this._rows[this.openCellKey];
        if (rowRef && rowRef.closeRow) {
{'fraction_non_alphanumeric': 0.1109657157812091, 'fraction_numerical': 0.004187385501177702, 'mean_word_length': 2.309090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '92168', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1031, 'n_words': 250}