<commit_before>import React from 'react';
import { requireNativeComponent, Platform, StyleSheet, View } from 'react-native';
import BackButton from './BackButton';

class TabBar extends React.Component<any, any> {
    private ref: React.RefObject<View>;
    constructor(props) {
        super(props);
        this.state = {selectedTab: props.selectedTab || 0};
        this.ref = React.createRef<View>();
        this.onTabSelected = this.onTabSelected.bind(this);
    }
    static defaultProps = {
        scrollable: false,
        primary: Platform.OS === 'ios',
    }
    static getDerivedStateFromProps({selectedTab}, state) {
        if (selectedTab != null && selectedTab !== state.selectedTab)
            return {selectedTab};
        return null;
    }
    onTabSelected({nativeEvent}) {
        var {eventCount: mostRecentEventCount, tab} = nativeEvent;
        this.ref.current.setNativeProps({mostRecentEventCount});
        this.changeTab(tab);
    }
    changeTab(tab) {
        var {selectedTab, onChangeTab} = this.props;
        if (this.state.selectedTab !== tab) {
            if (selectedTab == null)
                this.setState({selectedTab: tab});
            if (!!onChangeTab)
                onChangeTab(tab);
            return true;
        }
        return false;<commit_msg>Renamed seelctedTab prop to tab<commit_after>import React from 'react';
import { requireNativeComponent, Platform, StyleSheet, View } from 'react-native';
import BackButton from './BackButton';

class TabBar extends React.Component<any, any> {
    private ref: React.RefObject<View>;
    constructor(props) {
        super(props);
        this.state = {selectedTab: props.tab || 0};
        this.ref = React.createRef<View>();
        this.onTabSelected = this.onTabSelected.bind(this);
    }
    static defaultProps = {
        scrollable: false,
        primary: Platform.OS === 'ios',
    }
    static getDerivedStateFromProps({tab}, {selectedTab}) {
        if (tab != null && tab !== selectedTab)
            return {selectedTab: tab};
        return null;
    }
    onTabSelected({nativeEvent}) {
        var {eventCount: mostRecentEventCount, tab} = nativeEvent;
        this.ref.current.setNativeProps({mostRecentEventCount});
        this.changeTab(tab);
    }
    changeTab(selectedTab) {
        var {tab, onChangeTab} = this.props;
        if (this.state.selectedTab !== selectedTab) {
            if (tab == null)
                this.setState({selectedTab});
            if (!!onChangeTab)
                onChangeTab(selectedTab);
            return true;
        }
        return false;
{'fraction_non_alphanumeric': 0.12078220858895705, 'fraction_numerical': 0.0007668711656441718, 'mean_word_length': 2.5161725067385445, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1063723', 'n_tokens_mistral': 723, 'n_tokens_neox': 714, 'n_words': 163}