import React, { Component } from 'react';
import { View } from 'react-native';
import { Button, SearchBar } from 'antd-mobile';
import { StackNavigator, NavigationActions } from 'react-navigation';
import { connect } from 'react-redux';
import ListHouContent from './houseinfo/listhouse';
import Empty from '../empty';
import ErJiScreen from './houseinfo/erJiScreen';

class HouseList extends Component {
  state = {
    value: '',
  };

  action = () => {
    this.props.dispatch(NavigationActions.navigate({
      routeName: 'ERJi',
    }));
  };

  render() {
    return (
      <View style={{ flex: 1 }}>
        <SearchBar
          value={this.state.value}
          placeholder="搜索"
          onSubmit={value => console.log(value, 'onSubmit')}
          onClear={value => console.log(value, 'onClear')}
          onFocus={() => console.log('onFocus')}
          onBlur={() => console.log('onBlur')}
          onCancel={() => console.log('onCancel')}
          onChange={(value) => {
            this.setState({
              value,
            });
          }}
        />
        <ListHouContent navigation={this.props.navigation} />
      </View>
    );
  }
}
HouseList.router = ListHouContent.router;// 暂时加上，等下看看去掉会不会出错
const fwInfo = StackNavigator(
  {
    HouseList: { screen: connect()(HouseList) },
    ERJi: { screen: ErJiScreen },
    SanJiInfo: { screen: Empty('fangWuDetail', 'QuanLiRenScreen') },
  },
  {
    headerMode: 'none',
    navigationOptions: {
      gesturesEnabled: false,
    },
  },
);
export default fwInfo;
