All files / grid Col.js

100% Statements 9/9
100% Branches 12/12
100% Functions 1/1
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57          1x 3x       3x   3x             3x 1x                         2x                   1x               1x          
/*eslint-disable no-console */
import PropTypes from 'prop-types';
import React from 'react';
import { View, StyleSheet, TouchableOpacity } from 'react-native';
 
const Col = props => {
  console.warn(
    'Warning: Col has been deprecated and will be removed in a future version of React Native Elements'
  );
 
  const { containerStyle, size, onPress, activeOpacity } = props;
 
  const styles = StyleSheet.create({
    container: {
      flex: size ? size : containerStyle && containerStyle.width ? 0 : 1,
      flexDirection: 'column',
    },
  });
 
  if (onPress) {
    return (
      <TouchableOpacity
        style={[styles.container, containerStyle && containerStyle]}
        activeOpacity={activeOpacity}
        onPress={onPress}
      >
        <View {...props}>
          {props.children}
        </View>
      </TouchableOpacity>
    );
  }
 
  return (
    <View
      style={[styles.container, containerStyle && containerStyle]}
      {...props}
    >
      {props.children}
    </View>
  );
};
 
Col.propTypes = {
  size: PropTypes.number,
  containerStyle: PropTypes.any,
  onPress: PropTypes.func,
  activeOpacity: PropTypes.number,
  children: PropTypes.any,
};
 
Col.defaultProps = {
  activeOpacity: 1,
};
 
export default Col;