InputAccessoryView in a FlatList - onPress not firing #23899
Labels
Bug
Component: FlatList
Component: InputAccessoryView
Ran Commands
One of our bots successfully processed a command.
Resolution: Locked
This issue was locked by the bot.
🐛 Bug Report
I have a working
InputAccessoryView
within aView
. I have set thenativeID
to match theTextInput
which calls it. This works.In my case, I have multiple
TextInputs
rendered in aFlatList
. What I need is a generic set of buttons above the keyboard, which when pressed, enters that text into theTextInput
which called it.The way I imagined this working is to have a
InputAccessoryView
inside each rendered item in myFlatList
. This would mean I could have the info of each TextViews state value, and upon pressing one of these generic buttons in myInputAccessoryView
, I'd have my current rendered items state and modify it.However, the issue I have is that no onPress events are firing when
InputAccessoryView
is inside a rendered item of theFlatList
.Instead of firing any
onPress
events, it instead just closes the keyboard. Note, even simply puttingalert('something')
does not fireTo Reproduce
I don't have a working demo to show, but simply having a flat list with rendered items, each one containing a textbox (and unique value) and an
InputAccessoryView
An example (written, not run, so not checked the syntax fully)
Expected Behavior
Expect the function (in the above example) to call
this.updateItem
but does notCurrent Workaround
onFocus
of theTextInput
I set something likecurrentTextInput
into state. I can then use this on press of the button in theInputAccessoryView
. Seems a bit of a dodgy work around thoughEnvironment
react: 16.6.3
react-native: 0.58.4
react-native-cli: 2.0.1
The text was updated successfully, but these errors were encountered: