i have a ListView component that render calendar with list of events. data structure is:
const data = {
'092016':[{id:1,title:'event1'},{id:1,title:'event1'}],
'102016':[{id:1,title:'event1'},{id:1,title:'event1'}],
}
ListView code:
<ListView
style={{flex:1}}
dataSource={this.state.posts}
pageSize={3}
onEndReachedThreshold={200}
enableEmptySections={true}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps={true}
showsVerticalScrollIndicator={true}
renderRow={(event) => <Text>{event.title}</Text>}
renderSectionHeader={(data,month)=><Text>{month}</Text>}
/>
....dataSource = new ListView.DataSource({
rowHasChanged : (row1, row2) => row1 !== row2,
sectionHeaderHasChanged : (s1, s2) => s1 !== s2});
... on component mount
this.setState({posts:dataSource.cloneWithRowsAndSections(data)});
this works as expected.
now i want to be able to scroll to a specific section in js. how can i achive this ?
something like
scrollTo('102016') // scroll to section with id='102016'