Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set the _scrollComponent if it is undefined or null #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rahuljiresal
Copy link

This fixes the crash with Unhandled JS Exception: null is not an object (evaluating 'this._scrollComponent.getScrollResponder')

@ide
Copy link
Member

ide commented Nov 30, 2016

We want to set it to null or else we'll have memory leaks. Can you figure out what this._scrollComponent.getScrollResponder is being accessed even when the underlying scroll component has been unmounted?

@rahuljiresal
Copy link
Author

You're right about the leak. The leak will manifest into a crash after a long time, but it will do that.

I had a line that did this.refs.scrollView && this.refs.scrollView.scrollTo({x: 0, y: 0, animated: true}); where scrollView is the InvertibleScrollView. But since the underlying scrollview got unmounted somehow, when the scrollTo method tries to get the scrollResponder, it crashes.

I changed it to this.refs.scrollView && this.refs.scrollView._scrollComponent && this.refs.scrollView.scrollTo({x: 0, y: 0, animated: true}); and it works. But I think this.refs.scrollView should be undefined if the underlying scrollview has been unmounted.

@ide
Copy link
Member

ide commented Nov 30, 2016

Are you perhaps unmounting the InvertibleScrollView (this.refs.scrollView) and forgetting to unset to ref?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants