question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ScrollView] add onPageChange for scrollView with pagingEnabled=true.

See original GitHub issue

Just like onScroll handle, does it makes sense to add onPageChange handler for ScrollView with pagingEnabled=true?

Wondering how to get a callback when the page changes on pagingEnabled ScrollView’s now.

cc @ide @vjeux

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

16reactions
chirag04commented, Aug 7, 2015

@ide onMomentumScrollEnd is working. Sharing the code for anyone looking for it. Small core api is what i support so closing this for now.

We should def. document this function though.

onMomentumScrollEnd={this.handlePageChange}

handlePageChange: function(e) {
    var offset = e.nativeEvent.contentOffset;
    if(offset) {
      var page = Math.round(offset.x / WIDTH) + 1;
      if(this.state.page != page) {
        this.setState({page: page});
      }
    }
  },
2reactions
chirag04commented, Aug 6, 2015

@ide I agree with @vjeux. It is annoying to compute right now. Also, i guess you are talking about onMomentumScrollEnd or something. I couldn’t get that working.

onPageChanged makes sense also for anyone with pagingEnabled.

I will go ahead and try to make a PR then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there any way to make a paged ScrollView in SwiftUI?
To simplify Lorenzos answer, you can basically add UIScrollView.appearance().isPagingEnabled = true to your scrollview ...
Read more >
pagingEnabled | Apple Developer Documentation
A Boolean value that determines whether paging is enabled for the scroll view.
Read more >
react-native-paged-scroll-view - npm
I assume you'll use it with pagingEnabled={true} , and it doesn't add paged scrolling for Android. Example. PagedScrollViewExample. import { ...
Read more >
ScrollView - React Native
When true, the scroll view bounces horizontally when it reaches the end even if the content is smaller than the scroll view itself....
Read more >
What is the use of ScrollView component in React Native
pagingEnabled : If the value is set to true then the scroll view stops scrolling. This can be used for horizontal pagination.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found