title: React-Native TextInput that edits dynamic object key:values
body: <p>I'm working on a React-Native using Redux. One of the components renders a series of TextInput based on the elements in an object passed to it in it's props, that is read in from an API earlier in the app. </p>
  
  <p>I want to be able to edit the value and have it updated in the state. The object's keys, values, and length are all dynamic. All of my redux actions and reducers work, and my component is properly receiving it's props, so I'll try to boil this down to a very simple example. To illustrate my problem, let's say the component receives this object in it's props:</p>
  
  <pre><code> item:{
     type: monitor,
     make: HP,
     tag_number: 005
   }
  </code></pre>
  
  <p>The render method of my component creates and displays the textinputs thusly:</p>
  
  <pre><code>render(){
     var item_views = []
     for(index in this.props.item) {
       item_views.push(
            &lt;View key={index} style={styles.rowContainer}&gt;
            &lt;Text style={styles.label}&gt;{index} : &lt;/Text&gt;
            &lt;TextInput 
               style={styles.input_box}
               onSubmitEditing={(text) =&gt; this._update(index, text)}
               defaultValue={this.props.item[index].toString()}
               placeholder={index}&gt;
            &lt;/TextInput&gt;
            &lt;/View&gt;
       )
     }
     return (
       &lt;View&gt;
       {item_views}
       &lt;/View&gt;
     )
   }
  
   _update(index, text){
      //This is where I dispatch the action to change the value of "item[index]" to "text"
   }
  </code></pre>
  
  <p>This <em>almost</em> works, except that "index", which is always correctly displayed within the individual respective TextInputs in the render method, in the "_update" function ALWAYS resolves to the top key in the object, i.e. "type" in this example, no matter which text input I edit. How can I pass the correct index through textinput's onSubmitEditing function to my update function?</p>