In iOS with Objective-C we can make UITableView scroll to the particular row index by using scrollToRowAtIndexPath method but in React-Native I did NOT find such a way to scroll Listview at particular row index.
Following is the scenario,
- There is
Listviewwith such expandable rows like while tapping it expands and the expandable row containsTextInputcomponent. - While inputting text in
TextInput, the keyboard will be shown up and ideally at that momentListviewshould be scrolled to up (once the keyboard get downListviewshould be scrolled down to its previous position).
This can be easily achieved with Native-iOS but I am stuck in React-Native.
I TRIED FOLLOWING WAY BUT DID NOT ACHIEVE WELL
There is a method called scrollTo(x:0,y:10,animated:true) in Listview component (actually its method of Scrollview) by which it can be scrolled up/down based on the y coordinate of the parent view.
I successfully receive Keyboard's Up & Down events in my code and based on that I can somehow manage with scrollTo method (by calculating the y coordinate) when Keyboard gets up (as mentioned in @Alexey's answer) but I have NO idea about how to calculate y coordinate when Keyboard gets down? (At this moment ideally, the Listview should scroll down to its previous position).
Any help or hint would be appreciated!
