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

Getting issue in scrollView scrollTo #12739

Closed
krishbhattacharyya opened this issue Mar 6, 2017 · 3 comments
Closed

Getting issue in scrollView scrollTo #12739

krishbhattacharyya opened this issue Mar 6, 2017 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@krishbhattacharyya
Copy link

krishbhattacharyya commented Mar 6, 2017

Description

I am using scrollView when fetching data & changing scrollView position with "scrollView.scrollTo". I am getting error like bellow (Sometimes): ( In IOS, it is working )

com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'e.refs.scrollView.scrollTo'), stack:
value@605:5795
@605:6752
..............
............

Reproduction

var self = this;
Api.post(url, data_post, function(response) {
      if(response) {
        // my code updating the scrollView
        ............ 
	self.refs.scrollViewEdit.scrollTo({y: 0});
      }
      self.setState({animating: false });
    });
}

<ScrollView ref='scrollViewEdit'></ScrollView>

Additional Information

  • React Native version: ["0.40.0"]
  • Platform: [Android]
  • Operating System: [Linux]
@janicduplessis
Copy link
Contributor

This problem is probably that your component gets unmounted before the request finishes. You could add a check to make sure the ref still exists before calling scrollTo on it. Feel free to reopen if I am wrong.

@krishbhattacharyya
Copy link
Author

@janicduplessis thanks. I will try this. I think this will solve my problem.

@susan-github
Copy link

Did you resolve this issue? @krishbhattacharyya

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants