import React, { Component, PropTypes } from 'react';
import { View, Text, TouchableHighlight } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';

import styles from './index.style';

class PullSelect extends Component {
  constructor(props) {
    super(props);

    this.state = {
      selected: null,
    }

    this.onSelect = this.onSelect.bind(this);
    this.onPress = this.onPress.bind(this);
  }

  onSelect(selected) {
    this.setState({
      selected,
    });
    this.props.onChangeText(selected);
  }

  onPress() {
    this.props.navigation.navigate(this.props.screen, {
      onSelect: this.onSelect,
    });
  }

  render() {
    let { placeholder } = this.props;
    if (this.state.selected) {
      placeholder = this.state.selected.title;
    }
    
    return (
      <TouchableHighlight onPress={ this.onPress } underlayColor="#eee" >
        <View style={ styles.buttonWrapper }>
          <Text style={ styles.buttonText }>{ placeholder }</Text>
          <View style={ styles.buttonIcon }>
            <Icon name="chevron-right" size={ 20 } color="#ccc" />
          </View>
        </View>
      </TouchableHighlight>
    )
  }
}

PullSelect.propTypes = {
  placeholder: PropTypes.string.isRequired,
  screen: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
  onChangeText: PropTypes.func.isRequired,
}

PullSelect.defaultProps = {
  onChangeText: () => {},
}

export default PullSelect;

@@ -109,16 +109,70 @@
 ative';%0A
+import %7B NavigationActions %7D from 'react-navigation';%0A
 import I
@@ -489,130 +489,615 @@
 %0A%0A  
-onSelect(selected) %7B%0A    this.setState(%7B%0A      selected,%0A    %7D);%0A    this.props.onChangeText(selected);%0A  %7D%0A%0A  onPress() %7B
+componentWillReceiveProps(nextProps) %7B%0A    if (nextProps.selected !== this.props.selected) %7B%0A      this.setState(%7B%0A        selected: nextProps.selected,%0A      %7D);%0A    %7D%0A  %7D%0A%0A  onSelect(selected) %7B%0A    this.setState(%7B%0A      selected,%0A    %7D);%0A    this.props.onChangeText(selected);%0A  %7D%0A%0A  onPress() %7B%0A    if ('undefined' !== typeof this.props.action) %7B%0A      const action = NavigationActions.navigate(%7B%0A        ...this.props.action,%0A        params: %7B%0A          ...this.props.action.params,%0A          onSelect: this.onSelect,%0A        %7D,%0A      %7D)%0A      return this.props.screenProps.redirect(action);%0A    %7D%0A    
 %0A   
@@ -1811,35 +1811,52 @@
 Types.string
-.isRequired
+,%0A  action: PropTypes.object
 ,%0A  title: P
@@ -1883,16 +1883,46 @@
 quired,%0A
+  selected: PropTypes.object,%0A
   onChan

Support value change