this._scrollViewRef.scrollTo is not a function
See original GitHub issueThe recyclerlistview performance is very good. But i am having a issue with the onEndReached
props. After calling the onEndReached
i am adding the new data to the DataProvider. But after the data is added i m getting error this._scrollViewRef.scrollTo is not a function
class NewsList extends React.Component {
constructor(props) {
super(props);
this.dataProvider = new DataProvider((r1, r2) => {
return r1 !== r2;
}).cloneWithRows(this.props.list);
}
componentWillReceiveProps () {
this.setState(prevState => ({
dataProvider: prevState.dataProvider.cloneWithRows(this.props.list)
}))
}
render() {
return (
<View style={{flex:1}}>
<RecyclerListView
ref={ref => {this.listRef = ref;}}
contentContainerStyle={{paddingBottom:80}}
externalScrollView={ExtendedScrollView}
layoutProvider={this._layoutProvider}
dataProvider={this.state.dataProvider}
rowRenderer={this._rowRenderer}
onEndReached={() => this.props.handleLoadMore()}
onEndReachedThreshold={0.3}
renderFooter={this.renderFooter}
animatedEvent={{nativeEvent: {contentOffset: {y: this.scroll}}}}
renderAheadOffset={250}
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)} />
}
/>
</View>
);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:15
Top Results From Across the Web
scrollTo is undefined on animated ScrollView - Stack Overflow
@max23_ 's answer might work for now, but is not the correct way of doing it - as a rule ... scrollTo({ y:...
Read more >Scroll the Content: DevExtreme - JavaScript UI Components ...
scrollViewRef = React. ... scrollViewRef.current.instance ... To scroll the content to a specific position, call the scrollTo(targetLocation) method.
Read more >fear48/react-native - Gitter
scrollViewRef.scrollTo is not a function. getReference(ref) { this.scrollViewRef = ref; } scrollToItem = ({ index, id, postitionY }) => { this.scrollViewRef ...
Read more >Scroll to a Specific Item in ScrollView List View - About React
If you are not clear with the topic then you can imagine you have made a list using ... {/* List Item as...
Read more >ScrollView - React Native
If component have not been provided, the default ... Handler function is passed the content width and content height as ... scrollTo(
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This worked for me:
Thanks for your reply! @evert-smit, what I had imagined would be that the ref would be somehow magically passed on to the component but of course it would not be.
Reading your comment I did this 5min solution as I really need the ref to control it from some other UI components.
and setScrollViewRef will be passed on to the ExternalScrollView and you can do something like