<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import {
  View,
  StyleSheet,
  TouchableHighlight,
  Image,
  Platform,
  Switch,
  TextInput,
} from 'react-native';
import Badge from '../badge/badge';
import Icon from '../icons/Icon';
import Text from '../text/Text';
import colors from '../config/colors';
import fonts from '../config/fonts';
import normalize from '../helpers/normalizeText';

const ListItem = props => {
  const {
    onPress,
    title,
    leftIcon,
    rightIcon,
    leftIconContainerStyle,
    avatarStyle,
    underlayColor,
    subtitle,
    subtitleStyle,
    containerStyle,
    wrapperStyle,
    titleStyle,
    titleContainerStyle,
    hideChevron,
    chevronColor,
    roundAvatar,
    component,
    fontFamily,
    rightTitle,
    rightTitleContainerStyle,
    rightTitleStyle,
    subtitleContainerStyle,
    badge,
    label,
    onLongPress,
    switchButton,
    onSwitch,
    switchDisabled,
    switchOnTintColor,
    switchThumbTintColor,
    switchTintColor,
    switched,
    textInput,
    textInputAutoCapitalize,
    textInputAutoCorrect,
    textInputAutoFocus,
    textInputEditable,
    textInputKeyboardType,
    textInputMaxLength,
    textInputMultiline,
    textInputOnChangeText,
    textInputOnFocus,
    textInputOnBlur,
    textInputSelectTextOnFocus,
    textInputReturnKeyType,
    textInputValue,
    textInputSecure,
    textInputStyle,
    textInputContainerStyle,
    ...attributes
  } = props;

  let { avatar } = props;

  let Component = onPress || onLongPress ? TouchableHighlight : View;
  if (component) {
    Component = component;
  }
  if (typeof avatar === 'string') {
    avatar = { uri: avatar };
  }
  return (
    <Component
      onLongPress={onLongPress}
      onPress={onPress}
      underlayColor={underlayColor}
      style={[styles.container, containerStyle && containerStyle]}
      {...attributes}
    >
      <View style={[styles.wrapper, wrapperStyle && wrapperStyle]}>
        {React.isValidElement(leftIcon)
          ? leftIcon
          : leftIcon &&
              leftIcon.name &&
              <View
                style={[
                  styles.iconStyle,
                  leftIconContainerStyle && leftIconContainerStyle,
                ]}
              >
                <Icon
                  type={leftIcon.type}
                  iconStyle={[styles.icon, leftIcon.style && leftIcon.style]}
                  name={leftIcon.name}
                  color={leftIcon.color || colors.grey4}
                  size={leftIcon.size || 24}
                />
              </View>}
        {avatar &&
          <View style={styles.avatar}>
            {React.isValidElement(avatar)
              ? avatar
              : <Avatar
                  containerStyle={avatarStyle && avatarStyle}
                  rounded={roundAvatar}
                  source={avatar}/>}
          </View>}
        <View style={styles.titleSubtitleContainer}>
          <View style={titleContainerStyle}>
            {title && (typeof title === 'string' || typeof title === 'number')
              ? <Text
                  style={[
                    styles.title,
                    !leftIcon && { marginLeft: 10 },
                    titleStyle && titleStyle,
                    fontFamily && { fontFamily },
                  ]}
                >
                  {title}
                </Text>
              : <View>
                  {title}
                </View>}
          </View>
          <View style={subtitleContainerStyle}>
            {subtitle &&
              (typeof subtitle === 'string' || typeof subtitle === 'number')
              ? <Text
                  style={[<commit_msg>Fix import<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import {
  View,
  StyleSheet,
  TouchableHighlight,
  Image,
  Platform,
  Switch,
  TextInput,
} from 'react-native';
import Avatar from '../avatar/Avatar';
import Badge from '../badge/badge';
import Icon from '../icons/Icon';
import Text from '../text/Text';
import colors from '../config/colors';
import fonts from '../config/fonts';
import normalize from '../helpers/normalizeText';

const ListItem = props => {
  const {
    onPress,
    title,
    leftIcon,
    rightIcon,
    leftIconContainerStyle,
    avatarStyle,
    underlayColor,
    subtitle,
    subtitleStyle,
    containerStyle,
    wrapperStyle,
    titleStyle,
    titleContainerStyle,
    hideChevron,
    chevronColor,
    roundAvatar,
    component,
    fontFamily,
    rightTitle,
    rightTitleContainerStyle,
    rightTitleStyle,
    subtitleContainerStyle,
    badge,
    label,
    onLongPress,
    switchButton,
    onSwitch,
    switchDisabled,
    switchOnTintColor,
    switchThumbTintColor,
    switchTintColor,
    switched,
    textInput,
    textInputAutoCapitalize,
    textInputAutoCorrect,
    textInputAutoFocus,
    textInputEditable,
    textInputKeyboardType,
    textInputMaxLength,
    textInputMultiline,
    textInputOnChangeText,
    textInputOnFocus,
    textInputOnBlur,
    textInputSelectTextOnFocus,
    textInputReturnKeyType,
    textInputValue,
    textInputSecure,
    textInputStyle,
    textInputContainerStyle,
    ...attributes
  } = props;

  let { avatar } = props;

  let Component = onPress || onLongPress ? TouchableHighlight : View;
  if (component) {
    Component = component;
  }
  if (typeof avatar === 'string') {
    avatar = { uri: avatar };
  }
  return (
    <Component
      onLongPress={onLongPress}
      onPress={onPress}
      underlayColor={underlayColor}
      style={[styles.container, containerStyle && containerStyle]}
      {...attributes}
    >
      <View style={[styles.wrapper, wrapperStyle && wrapperStyle]}>
        {React.isValidElement(leftIcon)
          ? leftIcon
          : leftIcon &&
              leftIcon.name &&
              <View
                style={[
                  styles.iconStyle,
                  leftIconContainerStyle && leftIconContainerStyle,
                ]}
              >
                <Icon
                  type={leftIcon.type}
                  iconStyle={[styles.icon, leftIcon.style && leftIcon.style]}
                  name={leftIcon.name}
                  color={leftIcon.color || colors.grey4}
                  size={leftIcon.size || 24}
                />
              </View>}
        {avatar &&
          <View style={styles.avatar}>
            {React.isValidElement(avatar)
              ? avatar
              : <Avatar
                  containerStyle={avatarStyle && avatarStyle}
                  rounded={roundAvatar}
                  source={avatar}
                />}
          </View>}
        <View style={styles.titleSubtitleContainer}>
          <View style={titleContainerStyle}>
            {title && (typeof title === 'string' || typeof title === 'number')
              ? <Text
                  style={[
                    styles.title,
                    !leftIcon && { marginLeft: 10 },
                    titleStyle && titleStyle,
                    fontFamily && { fontFamily },
                  ]}
                >
                  {title}
                </Text>
              : <View>
                  {title}
                </View>}
          </View>
          <View style={subtitleContainerStyle}>
            {subtitle &&
              (typeof subtitle === 'string' || typeof subtitle === 'number')
              ? <Text
                  style={[
{'fraction_non_alphanumeric': 0.10377988513423267, 'fraction_numerical': 0.0013356484573260317, 'mean_word_length': 1.7743608743979251, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '6303787', 'n_tokens_mistral': 2068, 'n_tokens_neox': 1987, 'n_words': 402}