<commit_before>import React from 'react';
import { 
  StyleSheet,
  Text,
  View,
  ListView,
  Dimensions,
  ActivityIndicator,
} from 'react-native';

export default class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) => row1 !== row2,
      }),
      driverJson: [],
      isLoading: true,
    };
  }

  componentDidMount() {    

    return fetch('http://127.0.0.1:5000/get_drivers')
      .then((response) => response.json())
      .then((responseJson) => {
        console.log(responseJson),
        this.setState({
          isLoading: false,
          driverJson: responseJson,
          dataSource: this.state.dataSource.cloneWithRows(
            responseJson.MRData.StandingsTable
            .StandingsLists[0].DriverStandings),
        });
      })
      .catch((error) => {
        console.error(error);
      });

  }

  renderRow(standingCell, something, rowID) {
      return (
        <View style={styles.listElem}>

          <View style={styles.driverOrder}>
            <Text style={{color: 'grey'}}>
              {parseInt(rowID, 10) + 1}
            </Text>
          </View>

          <View style={styles.driverNameBox}>

            <Text>{standingCell.Driver.givenName + " "
              + standingCell.Driver.familyName}
            </Text>

            <Text style={{color: 'grey'}}>
              {standingCell.Constructors[0].name}</Text>

          </View>

          <View style={styles.driverPointsBox}>
            <Text style={{color: 'red'}}>
              {standingCell.points}</Text>
          </View>

        </View>
      )
  }

  render() {

    if (this.state.isLoading) {
      return (
        <View style={{flex: 1, paddingTop: 20}}>
          <ActivityIndicator />
        </View>
      );
    }

    return (
      <View style={styles.container}>
      
        <View style={styles.header}>
          <Text style={styles.headerText}>
            F1 Portal
          </Text>
        </View>

        <View style={styles.listHeader}>
          <Text style={styles.listHeaderText}>{
            this.state.driverJson.MRData.StandingsTable.season + " Drivers Championship"}</Text>
        </View>

        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center'}}>
          <ListView
            flex-start dataSource={this.state.dataSource}
            renderRow={this.renderRow.bind(this)}
            enableEmptySections={true}
          />
        </View>

      </View>
    );
  }<commit_msg>Centered spinner when loading<commit_after>import React from 'react';
import { 
  StyleSheet,
  Text,
  View,
  ListView,
  Dimensions,
  ActivityIndicator,
} from 'react-native';

export default class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) => row1 !== row2,
      }),
      driverJson: [],
      isLoading: true,
    };
  }

  componentDidMount() {    

    return fetch('http://127.0.0.1:5000/get_drivers')
      .then((response) => response.json())
      .then((responseJson) => {
        console.log(responseJson),
        this.setState({
          isLoading: false,
          driverJson: responseJson,
          dataSource: this.state.dataSource.cloneWithRows(
            responseJson.MRData.StandingsTable
            .StandingsLists[0].DriverStandings),
        });
      })
      .catch((error) => {
        console.error(error);
      });

  }

  renderRow(standingCell, something, rowID) {
      return (
        <View style={styles.listElem}>

          <View style={styles.driverOrder}>
            <Text style={{color: 'grey'}}>
              {parseInt(rowID, 10) + 1}
            </Text>
          </View>

          <View style={styles.driverNameBox}>

            <Text>{standingCell.Driver.givenName + " "
              + standingCell.Driver.familyName}
            </Text>

            <Text style={{color: 'grey'}}>
              {standingCell.Constructors[0].name}</Text>

          </View>

          <View style={styles.driverPointsBox}>
            <Text style={{color: 'red'}}>
              {standingCell.points}</Text>
          </View>

        </View>
      )
  }

  render() {

    if (this.state.isLoading) {
      return (
        <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
          <ActivityIndicator />
        </View>
      );
    }

    return (
      <View style={styles.container}>
      
        <View style={styles.header}>
          <Text style={styles.headerText}>
            F1 Portal
          </Text>
        </View>

        <View style={styles.listHeader}>
          <Text style={styles.listHeaderText}>{
            this.state.driverJson.MRData.StandingsTable.season + " Drivers Championship"}</Text>
        </View>

        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center'}}>
          <ListView
            flex-start dataSource={this.state.dataSource}
            renderRow={this.renderRow.bind(this)}
            enableEmptySections={true}
          />
        </View>

      </View>
    );
  }
{'fraction_non_alphanumeric': 0.14258336527405135, 'fraction_numerical': 0.008815638175546186, 'mean_word_length': 1.8770672546857774, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3235380', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1502, 'n_words': 265}