1

chargeTypeModelArrDly is my Array in React js, which will iterate for the 6 time and create 6 textfield. I am unable to get unique value with unique Id which will help me to do calculation in onEndEditing(e) with unique Id. please find the code below:

 _.each(this.props.chargeTypeModelArrDly,(chargeTypeModelArrDly,index))=>    
    {  <ListItem avatar key={index}>
          <TextInput 
                style={{width:50,height: 40, borderColor:'gray',borderWidth: 1}}
                defaultValue ={"0"}
                onEndEditing={(e) => this.onEndEditing(e) }
                keyboardType={'numeric'}
              />  
        </ListItem>
    }    
Milo
  • 3,365
  • 9
  • 30
  • 44
  • cant you use index? – Rishikesh Dhokare Feb 13 '18 at 13:36
  • Can you explain why do you need this Id ? Does `chargeTypeModelArrDly`contain an id ? Do you want a `ref` to `TextInput` or do you want to identify the call of `onEndEditing()` ? – Dyo Feb 13 '18 at 13:52
  • I try this code without Id but due to loop when I am giving value to the any of the text field inside loop It get override on all the text field inside loop,so I am unable get different value for the different text field .How do I get ref for the different text field,so I can get Value by it's ref for further calculation in function. – Vyankesh Harkya Feb 14 '18 at 06:19
  • Yes,I can use Index – Vyankesh Harkya Feb 14 '18 at 07:40
  • But the problem is I want to do further calculation in onEndEditing() function,where I cant get this index – Vyankesh Harkya Feb 14 '18 at 10:27

0 Answers0