Skip to content

Commit

Permalink
Merge pull request #701 from r0b0t3d/master
Browse files Browse the repository at this point in the history
Get correct carousel ref for RN 0.62.x
  • Loading branch information
Benoît Delmaire authored May 27, 2020
2 parents 24da861 + 4bcbe05 commit 0e5c1d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ export default class Carousel extends Component {
}

_getWrappedRef () {
if (this._carouselRef && (
(this._needsScrollView() && this._carouselRef.scrollTo) ||
(!this._needsScrollView() && this._carouselRef.scrollToOffset)
)) {
return this._carouselRef;
}
// https://github.com/facebook/react-native/issues/10635
// https://stackoverflow.com/a/48786374/8412141
return this._carouselRef && this._carouselRef.getNode && this._carouselRef.getNode();
Expand Down

0 comments on commit 0e5c1d4

Please sign in to comment.