<commit_before>import createNativeComponent from '../../modules/createNativeComponent'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import normalizeNativeEvent from '../../apis/PanResponder/normalizeNativeEvent'
import { Component, PropTypes } from 'react'
import StyleSheet from '../../apis/StyleSheet'
import StyleSheetPropType from '../../apis/StyleSheet/StyleSheetPropType'
import ViewStylePropTypes from './ViewStylePropTypes'

@NativeMethodsDecorator
class View extends Component {
  static propTypes = {
    accessibilityLabel: createNativeComponent.propTypes.accessibilityLabel,
    accessibilityLiveRegion: createNativeComponent.propTypes.accessibilityLiveRegion,
    accessibilityRole: createNativeComponent.propTypes.accessibilityRole,
    accessible: createNativeComponent.propTypes.accessible,
    children: PropTypes.any,
    onClick: PropTypes.func,
    onClickCapture: PropTypes.func,
    onMoveShouldSetResponder: PropTypes.func,
    onMoveShouldSetResponderCapture: PropTypes.func,
    onResponderGrant: PropTypes.func,
    onResponderMove: PropTypes.func,
    onResponderReject: PropTypes.func,
    onResponderRelease: PropTypes.func,
    onResponderTerminate: PropTypes.func,
    onResponderTerminationRequest: PropTypes.func,
    onStartShouldSetResponder: PropTypes.func,
    onStartShouldSetResponderCapture: PropTypes.func,
    onTouchCancel: PropTypes.func,
    onTouchCancelCapture: PropTypes.func,
    onTouchEnd: PropTypes.func,
    onTouchEndCapture: PropTypes.func,
    onTouchMove: PropTypes.func,
    onTouchMoveCapture: PropTypes.func,
    onTouchStart: PropTypes.func,
    onTouchStartCapture: PropTypes.func,
    pointerEvents: PropTypes.oneOf(['auto', 'box-none', 'box-only', 'none']),
    style: StyleSheetPropType(ViewStylePropTypes),
    testID: createNativeComponent.propTypes.testID
  };

  static defaultProps = {
    accessible: true,
    style: {}
  };

  constructor(props, context) {
    super(props, context)
    this._normalizeEventForHandler = this._normalizeEventForHandler.bind(this)
  }

  render() {
    const {
      pointerEvents,
      style,
      ...other
    } = this.props

    const flattenedStyle = StyleSheet.flatten(style)
    const pointerEventsStyle = pointerEvents && { pointerEvents }

    const props = {
      ...other,
      onClick: this._handleClick,
      onClickCapture: this._normalizeEventForHandler(this.props.onClickCapture),
      onTouchCancel: this._normalizeEventForHandler(this.props.onTouchCancel),
      onTouchCancelCapture: this._normalizeEventForHandler(this.props.onTouchCancelCapture),
      onTouchEnd: this._normalizeEventForHandler(this.props.onTouchEnd),
      onTouchEndCapture: this._normalizeEventForHandler(this.props.onTouchEndCapture),
      onTouchMove: this._normalizeEventForHandler(this.props.onTouchMove),
      onTouchMoveCapture: this._normalizeEventForHandler(this.props.onTouchMoveCapture),
      onTouchStart: this._normalizeEventForHandler(this.props.onTouchStart),
      onTouchStartCapture: this._normalizeEventForHandler(this.props.onTouchStartCapture),
      style: [
        styles.initial,
        style,
        // 'View' needs to use 'flexShrink' in its reset when there is no 'flex' style provided
        (flattenedStyle.flex == null && flattenedStyle.flexShrink == null) && styles.flexReset,
        pointerEventsStyle
      ]
    }

    return createNativeComponent(props)
  }
<commit_msg>[fix] support 'onClick' prop in 'View'<commit_after>import createNativeComponent from '../../modules/createNativeComponent'
import NativeMethodsDecorator from '../../modules/NativeMethodsDecorator'
import normalizeNativeEvent from '../../apis/PanResponder/normalizeNativeEvent'
import { Component, PropTypes } from 'react'
import StyleSheet from '../../apis/StyleSheet'
import StyleSheetPropType from '../../apis/StyleSheet/StyleSheetPropType'
import ViewStylePropTypes from './ViewStylePropTypes'

@NativeMethodsDecorator
class View extends Component {
  static propTypes = {
    accessibilityLabel: createNativeComponent.propTypes.accessibilityLabel,
    accessibilityLiveRegion: createNativeComponent.propTypes.accessibilityLiveRegion,
    accessibilityRole: createNativeComponent.propTypes.accessibilityRole,
    accessible: createNativeComponent.propTypes.accessible,
    children: PropTypes.any,
    onClick: PropTypes.func,
    onClickCapture: PropTypes.func,
    onMoveShouldSetResponder: PropTypes.func,
    onMoveShouldSetResponderCapture: PropTypes.func,
    onResponderGrant: PropTypes.func,
    onResponderMove: PropTypes.func,
    onResponderReject: PropTypes.func,
    onResponderRelease: PropTypes.func,
    onResponderTerminate: PropTypes.func,
    onResponderTerminationRequest: PropTypes.func,
    onStartShouldSetResponder: PropTypes.func,
    onStartShouldSetResponderCapture: PropTypes.func,
    onTouchCancel: PropTypes.func,
    onTouchCancelCapture: PropTypes.func,
    onTouchEnd: PropTypes.func,
    onTouchEndCapture: PropTypes.func,
    onTouchMove: PropTypes.func,
    onTouchMoveCapture: PropTypes.func,
    onTouchStart: PropTypes.func,
    onTouchStartCapture: PropTypes.func,
    pointerEvents: PropTypes.oneOf(['auto', 'box-none', 'box-only', 'none']),
    style: StyleSheetPropType(ViewStylePropTypes),
    testID: createNativeComponent.propTypes.testID
  };

  static defaultProps = {
    accessible: true,
    style: {}
  };

  constructor(props, context) {
    super(props, context)
    this._normalizeEventForHandler = this._normalizeEventForHandler.bind(this)
  }

  render() {
    const {
      pointerEvents,
      style,
      ...other
    } = this.props

    const flattenedStyle = StyleSheet.flatten(style)
    const pointerEventsStyle = pointerEvents && { pointerEvents }

    const props = {
      ...other,
      onClick: this._normalizeEventForHandler(this.props.onClick),
      onClickCapture: this._normalizeEventForHandler(this.props.onClickCapture),
      onTouchCancel: this._normalizeEventForHandler(this.props.onTouchCancel),
      onTouchCancelCapture: this._normalizeEventForHandler(this.props.onTouchCancelCapture),
      onTouchEnd: this._normalizeEventForHandler(this.props.onTouchEnd),
      onTouchEndCapture: this._normalizeEventForHandler(this.props.onTouchEndCapture),
      onTouchMove: this._normalizeEventForHandler(this.props.onTouchMove),
      onTouchMoveCapture: this._normalizeEventForHandler(this.props.onTouchMoveCapture),
      onTouchStart: this._normalizeEventForHandler(this.props.onTouchStart),
      onTouchStartCapture: this._normalizeEventForHandler(this.props.onTouchStartCapture),
      style: [
        styles.initial,
        style,
        // 'View' needs to use 'flexShrink' in its reset when there is no 'flex' style provided
        (flattenedStyle.flex == null && flattenedStyle.flexShrink == null) && styles.flexReset,
        pointerEventsStyle
      ]
    }

    return createNativeComponent(props)
  }

{'fraction_non_alphanumeric': 0.09334485738980121, 'fraction_numerical': 0.0, 'mean_word_length': 4.441222570532916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '748656', 'n_tokens_mistral': 1919, 'n_tokens_neox': 1933, 'n_words': 341}