In NativeiOS you can make a UITableView scroll to a particular UITableViewCell using:
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:87 inSection:0]
atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
.. or similar.
For example, if the ListView held 100 items and I wanted to scroll such that the 87th item is visible.
Looking at the React Native ListView Docs there's nothing obvious there.
Has anyone managed to achieve this? I realise that ListView does not wrap UITableView so we can't just expose the method.
EDIT: Looks like some support for this is in the 0.19-rc release, check this https://github.com/facebook/react-native/releases
https://github.com/facebook/react-native/commit/33e05a11f00d1455f39b6dfef1c76c4130df02e5
Use a ScrollView
with contentOffset={{ x: offsetX, y: offsetY }}
and calculate the offset variables depending on which row you want to scroll to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With