<commit_before>'use strict';

import React, {
  ListView,
  Component,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Alert,
  TouchableHighlight
} from 'react-native';

import * as ideaActions from '../actions/ideaActions';
import {bindActionCreators} from 'redux';
import { connect } from 'react-redux';

// import css variables
import design from '../design';

import IdeaCell from '../components/IdeaCell';
import AddIdea from '../components/AddIdea';

import { SwipeListView } from 'react-native-swipe-list-view';

class IdeasList extends Component {
  constructor(props) {
    super(props);
  }

  _handleNextButtonPress(nextRoute) {
    this.props.navigator.push(nextRoute);
  }

  _handleRemoveIdea(rowID) {
    const { actions } = this.props;

    Alert.alert(
      'Confirm suppression',
      'Are you sure you want to delete this idea?',
      [{
        text: 'OK', onPress: () => {
          actions.remove(rowID);
          this.props.navigator.pop();
        }
      },
      {
        text: 'Cancel'
      }]
    );
  }

  _handleAddIdea() {
    this.props.navigator.push({
      title: 'New idea',
      component: AddIdea,
      rightButtonTitle: '',
      leftButtonIcon: '',
      passProps: {
        newIdea: true
      }
    });
  }

  render() {
    const { state } = this.props;

    var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});

    if(state.ideas.length) {<commit_msg>Fix remove idea index<commit_after>'use strict';

import React, {
  ListView,
  Component,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Alert,
  TouchableHighlight
} from 'react-native';

import * as ideaActions from '../actions/ideaActions';
import {bindActionCreators} from 'redux';
import { connect } from 'react-redux';

// import css variables
import design from '../design';

import IdeaCell from '../components/IdeaCell';
import AddIdea from '../components/AddIdea';

import { SwipeListView } from 'react-native-swipe-list-view';

class IdeasList extends Component {
  constructor(props) {
    super(props);
  }

  _handleNextButtonPress(nextRoute) {
    this.props.navigator.push(nextRoute);
  }

  _handleRemoveIdea(rowID) {
    const { state, actions } = this.props;
    var index = state.ideas.length - parseInt(rowID) - rowID;

    Alert.alert(
      'Confirm suppression',
      'Are you sure you want to delete this idea?',
      [{
        text: 'OK', onPress: () => {
          actions.remove(index);
        }
      },
      {
        text: 'Cancel'
      }]
    );
  }

  _handleAddIdea() {
    this.props.navigator.push({
      title: 'New idea',
      component: AddIdea,
      rightButtonTitle: '',
      leftButtonIcon: '',
      passProps: {
        newIdea: true
      }
    });
  }

  render() {
    const { state } = this.props;

    var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});

    if(state.ideas.length) {
{'fraction_non_alphanumeric': 0.1375387797311272, 'fraction_numerical': 0.002757669769045157, 'mean_word_length': 2.659520807061791, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '940543', 'n_tokens_mistral': 967, 'n_tokens_neox': 923, 'n_words': 212}