<commit_before>import React, { Component } from 'react';
import {
  ListView,
} from 'react-native';
import { List, ListItem, Icon } from 'react-native-elements';
import { NavigationActions, StackNavigator } from 'react-navigation';

import Page from '../../components/Page';

import { isLoginin } from '../../utils/permission';

import styles from './index.style';

const list = [
  {
    name: '<NAME>',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
    subtitle: '你在哪里？',
  },
  {
    name: '<NAME>',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
    subtitle: '明天去野外烧烤吧？',
  },
]
class MessageScreen extends Component {
  static navigationOptions = ({ navigation, screenProps }) => {
    const { navigate } = navigation;
    return {
      title: 'Message',
      headerLeft: <Icon name="view-headline" containerStyle={styles.nav.leftWrapper} onPress={async () => {
        if (await isLoginin()) {
          navigate('DrawerOpen');
        } else {
          screenProps.redirectLogin();
        }
      }} />,
      headerRight: false,
      headerVisible: true,

      tabBarLabel: 'Message',
      tabBarIcon: ({ tintColor }) => <Icon name="message" iconStyle={{ color: tintColor }} />,
    }
  }

  constructor(props) {
    super(props);

    const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
    this.state = {
      dataSource: ds.cloneWithRows(list),
    };

    this.onChat = this.onChat.bind(this);
    this.renderRow = this.renderRow.bind(this);
  }

  onChat(rowData) {
    this.props.screenProps.redirect(NavigationActions.navigate({
      routeName: 'Chat',
      params: {
        name: rowData.name,
      }
    }));
  }

  renderRow(rowData, sectionID) {
    return (
      <ListItem
        roundAvatar
        key={sectionID}
        title={rowData.name}
        subtitle={rowData.subtitle}
        avatar={{ uri: rowData.avatar_url }}
        hideChevron={false}
        rightIcon={{ name: 'chevron-right' }}
        onPress={() => this.onChat(rowData)}
      />
    )
  }

  render() {
    return (
      <Page
        enableLoad={false}
      >
        <ListView
          renderRow={this.renderRow}
          dataSource={this.state.dataSource}
        />
      </Page>
    )
  }
}

const MessageStack = StackNavigator({
  Message: {
    screen: MessageScreen,
  },<commit_msg>Fix exception while login button pressed<commit_after>import React, { Component } from 'react';
import {
  ListView,
} from 'react-native';
import { List, ListItem, Icon } from 'react-native-elements';
import { NavigationActions, StackNavigator } from 'react-navigation';

import Page from '../../components/Page';

import { isLoginin } from '../../utils/permission';

import styles from './index.style';

const list = [
  {
    name: '<NAME>',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
    subtitle: '你在哪里？',
  },
  {
    name: '<NAME>',
    avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
    subtitle: '明天去野外烧烤吧？',
  },
]
class MessageScreen extends Component {
  static navigationOptions = ({ navigation, screenProps }) => {
    const { navigate } = navigation;
    return {
      title: 'Message',
      headerLeft: <Icon name="view-headline" containerStyle={styles.nav.leftWrapper} onPress={async () => {
        if (await isLoginin()) {
          navigate('DrawerOpen');
        } else {
          screenProps.redirectLogin();
        }
      }} />,
      headerRight: false,
      headerVisible: true,

      tabBarLabel: 'Message',
      tabBarIcon: ({ tintColor }) => <Icon name="message" iconStyle={{ color: tintColor }} />,
    }
  }

  constructor(props) {
    super(props);

    const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
    this.state = {
      dataSource: ds.cloneWithRows(list),
    };

    this.onChat = this.onChat.bind(this);
    this.renderRow = this.renderRow.bind(this);
  }

  onChat(rowData) {
    this.props.screenProps.redirect(NavigationActions.navigate({
      routeName: 'Chat',
      params: {
        name: rowData.name,
      }
    }));
  }

  renderRow(rowData, sectionID) {
    return (
      <ListItem
        roundAvatar
        key={sectionID}
        title={rowData.name}
        subtitle={rowData.subtitle}
        avatar={{ uri: rowData.avatar_url }}
        hideChevron={false}
        rightIcon={{ name: 'chevron-right' }}
        onPress={() => this.onChat(rowData)}
      />
    )
  }

  render() {
    return (
      <Page
        {...this.props}
        enableLoad={false}
      >
        <ListView
          renderRow={this.renderRow}
          dataSource={this.state.dataSource}
        />
      </Page>
    )
  }
}

const MessageStack = StackNavigator({
  Message: {
    screen: MessageScreen,
  },
{'fraction_non_alphanumeric': 0.15233011701909258, 'fraction_numerical': 0.004927119687949086, 'mean_word_length': 2.5432727272727274, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 4, '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': '3204263', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1577, 'n_words': 286}