0

I have a Flatlist that is creating a list of my custom component DocumentItem. DocumentItem contains a TextInput:

<TextInput style={styles.title} editable={props.isEditable}>{props.title}</TextInput>

For each of these TextInputs created, I also have a button called "Rename" that I want to focus on that TextInput and make it editable when it is clicked.

<MenuOption onSelect={() => {}} text='Rename' />

However, I can't think of a way to reference the dynamically created TextInput

klippy
  • 245
  • 3
  • 15

1 Answers1

0

Create a reference of your textinput component and then just call yourReference.focus() method in the button onPress action

Example

Roberto Clavijo
  • 149
  • 1
  • 6
  • But that's the problem. I don't know how to dynamically create a reference for the TextInputs – klippy Feb 13 '20 at 12:56