content: /**
   * Created by feng on 16/12/10.
   */
  import React, { Component } from 'react';
  import {
      AppRegistry,
      StyleSheet,
      Text,
      View,
      Image,
      TouchableOpacity,
      Switch,
      Platform,
  
  } from 'react-native';
  
  
  var IMWindow = require('Dimensions').get('window');
  
  
  var IMHeaderTopCell = React.createClass({
      // getDefaultProps方法
      getDefaultProps(){
          return{
              cellHeight: 0,
              iconName:"",
              title: "",
              isSwitch: false,
              description: "",
              descriptionIcon:""
          }
      },
  
      // getInitialState方法
      getInitialState(){
          return{
              isOn: false,
          }
      },
  
      // render方法
      render(){
          return(
              <TouchableOpacity>
                  <View style={styles.cellContainer}>
                      <View style={styles.cellLeftView}>
                          {/*<Image style={styles.cellLeftImage}/>*/}
                          {this.iconOrNot()}
                          <Text style={styles.cellLeftText}>
                              {this.props.title}
                          </Text>
                      </View>
                      {this.switchOrNot()}
                  </View>
              </TouchableOpacity>
          )
      },
  
      // componentDidMount方法,在这里直接放置需要的方法即可
      componentDidMount(){
  
      },
  
      //之后就是自定义的方法
  
      iconOrNot(){
          if(this.props.iconName.length>0){
              return(
                  <Image style={styles.cellLeftImage} source={{uri: this.props.iconName}}/>
              )
          }
      },
  
      switchOrNot(){
          if(this.props.isSwitch){
              return(
                  <Switch value={this.state.isOn}
                          onValueChange={()=>{this.setState({isOn: !this.state.isOn})}}
                          style={styles.cellRightSwitch}
                  />
              )
          }else {
              return(
                  <View style={styles.cellRightCombined}>
                      {this.descriptionOrNot()}
                      <Image source={{uri: 'icon_cell_rightArrow'}} style={styles.cellRightImage}/>
                  </View>
              )
          }
      },
  
      descriptionOrNot(){
          if(this.props.description.length>0){
              return(
                  <Text style={styles.cellRightDescription}>
                      {this.props.description}
                  </Text>
              )
          }else if(this.props.descriptionIcon.length>0){
              return(
                  <Image source={{uri:this.props.descriptionIcon}} style={styles.cellRightDescriptionIcon}/>
              )
          }
  
      },
  
  
  
  
  });
  
  const styles = StyleSheet.create({
  
      cellContainer:{
          backgroundColor: 'rgba(255,96,0,1.0)',//rgba(255,96,0,1.0)
          flexDirection: 'row',
          justifyContent: 'space-between',
          height: 60,
          alignItems: 'center',
          width: IMWindow.width,
          marginTop: Platform.OS == 'ios' ? 300: 0,
          // borderBottomWidth: 0.5,
          // borderBottomColor: 'rgba(0,0,0,0.2)',
  
      },
      cellLeftView:{
          flexDirection: 'row',
          alignItems:'center',
          marginLeft: 10,
  
      },
      cellLeftImage:{
          width: 50,
          height:50,
          backgroundColor: 'red',
          // marginLeft: 5,
          borderRadius: 25,
      },
  
      cellLeftText:{
          // backgroundColor: 'orange',
          marginLeft: 7,
          fontSize: 16,
      },
      cellRightCombined:{
          flexDirection:'row',
          marginRight:0,
          alignItems:'center',
  
      },
      cellRightImage:{
          width: 10,
          height: 15,
          // backgroundColor: 'blue',
          marginRight: 10,
          backgroundColor:'rgba(255,96,0,0)'
      },
      cellRightSwitch:{
          // backgroundColor: 'red',
          marginRight: 12,
      },
      cellRightDescription:{
          // backgroundColor: 'red',
          marginRight: 5,
      },
      cellRightDescriptionIcon:{
          width:26,
          height:16,
          backgroundColor: 'blue',
          marginRight:5,
          borderRadius:8,
  
      },
  
  });
  
  module.exports = IMHeaderTopCell;