import React, { Component } from "react";
import { View, ListView, ViewPropTypes } from "react-native";

import { connectStyle } from "native-base-shoutem-theme";
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames";

class Card extends Component {
  render() {
    if (this.props.dataArray && this.props.renderRow) {
      const ds = new ListView.DataSource({
        rowHasChanged: (r1, r2) => r1 !== r2
      });
      const dataSource = ds.cloneWithRows(this.props.dataArray);
      return (
        <ListView
          {...this.props}
          enableEmptySections
          dataSource={dataSource}
          renderRow={this.props.renderRow}
        />
      );
    }
    return (
      <View ref={c => (this._root = c)} {...this.props}>
        {this.props.children}
      </View>
    );
  }
}

Card.propTypes = {
  ...ViewPropTypes,
  style: React.PropTypes.object,
  dataArray: React.PropTypes.object,
  renderRow: React.PropTypes.object
};

const StyledCard = connectStyle("NativeBase.Card", {}, mapPropsToStyleNames)(
  Card
);

export { StyledCard as Card };

import React, { Component } from "react";
import { View, ListView, ViewPropTypes } from "react-native";

import { connectStyle } from "native-base-shoutem-theme";
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames";

class Card extends Component {
  render() {
    if (this.props.dataArray && this.props.renderRow) {
      const ds = new ListView.DataSource({
        rowHasChanged: (r1, r2) => r1 !== r2
      });
      const dataSource = ds.cloneWithRows(this.props.dataArray);
      return (
        <ListView
          {...this.props}
          enableEmptySections
          dataSource={dataSource}
          renderRow={this.props.renderRow}
        />
      );
    }
    return (
      <View ref={c => (this._root = c)} {...this.props}>
        {this.props.children}
      </View>
    );
  }
}

Card.propTypes = {
  ...ViewPropTypes,
  style: React.PropTypes.object,
  dataArray: React.PropTypes.array,
  renderRow: React.PropTypes.object
};

const StyledCard = connectStyle("NativeBase.Card", {}, mapPropsToStyleNames)(
  Card
);

export { StyledCard as Card };

fix wrong type definition in card