phodal/growth

View on GitHub
src/components/discover/view/SimpleListItem.js

Summary

Maintainability
A
35 mins
Test Coverage
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { TouchableHighlight, View, Text } from 'react-native';
import AppStyle from '../../../theme/styles';
import Line from '../../Line';

class SimpleListItem extends Component {
  static componentName = 'SimpleListItem';

  static propTypes = {
    click: PropTypes.func,
    underlayColor: PropTypes.string,
    backgroundColor: PropTypes.string,
    text: PropTypes.string.isRequired,
  };

  static defaultProps = {
    click: () => {},
    underlayColor: 'rgba(250, 250, 250, .9)',
    backgroundColor: 'white',
    text: '',
  };

  render() {
    return (
      <TouchableHighlight
        onPress={this.props.click}
        underlayColor={this.props.underlayColor}
        style={{ backgroundColor: this.props.backgroundColor }}
        key={this.props.text}
      >
        <View>
          <View style={AppStyle.simpleListItemStyle}>
            <Text>{this.props.text}</Text>
          </View>
          <Line />
        </View>
      </TouchableHighlight>
    );
  }
}
export default SimpleListItem;