// @flow
/**
 * All About Olaf
 * A list of the items availiable from a single menuSection
 */

import React from 'react'
import {
  StyleSheet,
  View,
  Text,
  ListView,
} from 'react-native'

let styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    marginLeft: 5,
    marginRight: 5,
  },
  name: {
    textAlign: 'left',
  },
  price: {
    textAlign: 'right',
  },
})

import type {MenuItemType} from './types'

export default class CageMenuView extends React.Component {
  static propTypes = {
    items: React.PropTypes.arrayOf(React.PropTypes.object),
  }

  state = {
    dataSource: new ListView.DataSource({
      rowHasChanged: this._rowHasChanged,
    }).cloneWithRows(this.props.items),
  }

  _rowHasChanged(r1: MenuItemType, r2: MenuItemType) {
    return r1.name !== r2.name
  }

  _renderRow(data: MenuItemType) {
    return (
      <View style={styles.container}>
        <Text style={styles.name}>{data.name}</Text>
        <Text style={styles.price}>{data.price}</Text>
      </View>
    )
  }

  render() {
    return (
      <View style={styles.container}>
        <ListView
          dataSource={this.state.dataSource}
          renderRow={this._renderRow.bind(this)}
        />
      </View>
    )
  }
}

@@ -1077,48 +1077,8 @@
 n (%0A
-      %3CView style=%7Bstyles.container%7D%3E%0A  
     
@@ -1097,18 +1097,16 @@
         
- 
- 
 dataSour
@@ -1132,18 +1132,16 @@
 Source%7D%0A
-  
         
@@ -1191,23 +1191,56 @@
     
-/%3E
+contentContainerStyle=%7Bstyles.container%7D
 %0A      
-%3C/View
+/
 %3E%0A  

remove redundant <View> element from MenuItem