<commit_before>import React, { Component, PropTypes } from 'react';
import { ScrollView, Text, View } from 'react-native';
import { connect } from 'react-redux';
import SearchTextInput from '../components/songs/SearchTextInput';
import CategoryButton from '../components/songs/CategoryButton';
import HeaderLogo from '../components/common/HeaderLogo';
import AppStyles from '../helpers/Styles';
import { fetchSongs } from '../redux/songs';
import NavigationButtonListView from '../components/navigation/NavigationButtonListView';

@connect((state) => ({
  categories: state.songs.categories
}), {
  fetchSongs
})
export default class HomeScreen extends Component {
  static navigationOptions = {
    header: () => ({
      style: AppStyles.header,
      title: <HeaderLogo />
    })
  };

  static propTypes = {
    navigation: PropTypes.shape({
      navigate: PropTypes.func.isRequired
    }).isRequired,
    fetchSongs: PropTypes.func.isRequired,
    categories: PropTypes.arrayOf(PropTypes.shape({
      id: PropTypes.number.isRequired,
      name: PropTypes.string.isRequired
    })).isRequired
  };

  componentDidMount () {
    if (this.props.categories.length) {
      this.props.fetchSongs();
    }
  }

  render () {
    const { navigation, categories } = this.props;
    return (
      <ScrollView style={AppStyles.background}>
        <View><commit_msg>Fix bug in initial song loading<commit_after>import React, { Component, PropTypes } from 'react';
import { ScrollView, Text, View } from 'react-native';
import { connect } from 'react-redux';
import SearchTextInput from '../components/songs/SearchTextInput';
import CategoryButton from '../components/songs/CategoryButton';
import HeaderLogo from '../components/common/HeaderLogo';
import AppStyles from '../helpers/Styles';
import { fetchSongs } from '../redux/songs';
import NavigationButtonListView from '../components/navigation/NavigationButtonListView';

@connect((state) => ({
  categories: state.songs.categories
}), {
  fetchSongs
})
export default class HomeScreen extends Component {
  static navigationOptions = {
    header: () => ({
      style: AppStyles.header,
      title: <HeaderLogo />
    })
  };

  static propTypes = {
    navigation: PropTypes.shape({
      navigate: PropTypes.func.isRequired
    }).isRequired,
    fetchSongs: PropTypes.func.isRequired,
    categories: PropTypes.arrayOf(PropTypes.shape({
      id: PropTypes.number.isRequired,
      name: PropTypes.string.isRequired
    })).isRequired
  };

  componentDidMount () {
    if (!this.props.categories.length) {
      this.props.fetchSongs();
    }
  }

  render () {
    const { navigation, categories } = this.props;
    return (
      <ScrollView style={AppStyles.background}>
        <View>
{'fraction_non_alphanumeric': 0.13132048017460896, 'fraction_numerical': 0.0, 'mean_word_length': 3.67687074829932, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '6317333', 'n_tokens_mistral': 763, 'n_tokens_neox': 766, 'n_words': 176}