import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { NavigationActions } from 'react-navigation';
import { ScrollView, View, TouchableOpacity} from 'react-native';
import Icon from 'react-native-vector-icons/dist/Ionicons';
import Size from '../config/size'
import Text from 'react-native-text';
const size = new Size
import { observer,inject } from 'mobx-react/native';
import {scale, verticalScale, moderateScale } from 'react-native-size-matters';
import AsyncStorageHelper from "../config/asyncStorageHelper";
const asyncStorageHelper = new AsyncStorageHelper();
const items = [{id: 0,title:"Menu of the Day", icon:"md-beer",screen: "menu"},
{id: 1, title:"My Orders", icon:"md-list-box",screen: "myOrders"},
{id: 2, title:"Account", icon:"md-contact",screen: "account"},
{id: 3, title:"Settings", icon:"md-settings",screen: "settings"},]
@inject(["menuStore"],["userStore"])
@observer
export default class SideMenu extends Component {
constructor(props) {
super(props);
this.store = this.props.userStore
}
onPressAction(screen){
this.props.navigation.navigate('DrawerClose')
console.log(this.store.logined +screen)
if(this.store.logined){
//this.navigateToScreen('account')
this.props.navigation.navigate(screen)
}else{
this.props.navigation.navigate('Login')
}
}
renderItems(){
return items.map((item) => {
return (
this.onPressAction(item.screen)} key = {item.id}>
{item.title}
);
});
}
render() {
return (
Hello
{this.renderItems()}
{ asyncStorageHelper.removeItemValue("pickupPointId")}} />
)
}
}