<commit_before>// @flow
import React from 'react'
import {
  TouchableOpacity,
  TouchableHighlight,
  TouchableNativeFeedback,
  Platform,
  View,
} from 'react-native'

type PropsType = {
  highlight?: boolean,
  onPress?: () => any,
  children?: any,
  borderless?: boolean,
  style?: any,
};
export const Touchable = ({
  children,
  style,
  highlight=true,
  borderless=false,
  onPress=() => {},
  ...props
}: PropsType) => {
  // The child <View> is required; the Touchable needs a View as its direct child.
  const content = <View style={style}>{children}</View>

  switch (Platform.OS) {
    default:
    case 'ios': {
      const Component = highlight ? TouchableHighlight : TouchableOpacity
      const innerProps = highlight ? {underlayColor: '#ebebeb'} : {activeOpacity: 0.65}
      return (
        <Component onPress={onPress} {...innerProps} {...props}>
          {content}
        </Component>
      )
    }
    case 'android': {
      const background = borderless
        ? TouchableNativeFeedback.SelectableBackgroundBorderless()
        : TouchableNativeFeedback.SelectableBackground()
      return (
        <TouchableNativeFeedback onPress={onPress} background={background} {...props}>
          {content}
        </TouchableNativeFeedback>
      )
    }
  }
}<commit_msg>check for android version before using borderless touchable (#605)<commit_after>// @flow
import React from 'react'
import {
  TouchableOpacity,
  TouchableHighlight,
  TouchableNativeFeedback,
  Platform,
  View,
} from 'react-native'

type PropsType = {
  highlight?: boolean,
  onPress?: () => any,
  children?: any,
  borderless?: boolean,
  style?: any,
};
export const Touchable = ({
  children,
  style,
  highlight=true,
  borderless=false,
  onPress=() => {},
  ...props
}: PropsType) => {
  // The child <View> is required; the Touchable needs a View as its direct child.
  const content = <View style={style}>{children}</View>

  switch (Platform.OS) {
    default:
    case 'ios': {
      const Component = highlight ? TouchableHighlight : TouchableOpacity
      const innerProps = highlight ? {underlayColor: '#ebebeb'} : {activeOpacity: 0.65}
      return (
        <Component onPress={onPress} {...innerProps} {...props}>
          {content}
        </Component>
      )
    }
    case 'android': {
      const canBorderless = Platform.Version >= 21
      const background = borderless && canBorderless
        ? TouchableNativeFeedback.SelectableBackgroundBorderless()
        : TouchableNativeFeedback.SelectableBackground()
      return (
        <TouchableNativeFeedback onPress={onPress} background={background} {...props}>
          {content}
        </TouchableNativeFeedback>
      )
    }
  }
}
{'fraction_non_alphanumeric': 0.12716549944710653, 'fraction_numerical': 0.004054552156284556, 'mean_word_length': 3.0386904761904763, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, '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': '5604174', 'n_tokens_mistral': 812, 'n_tokens_neox': 794, 'n_words': 197}