Skip to content

ScrollView snapToInterval iOS not working [android integration?] #13665

@julesmoretti

Description

@julesmoretti

Description

Explain what you did:
Implemented a column ScrollView (say 400 in height) with smaller height cards inside it (say 100 in height).

Added:

pagingEnabled
snapToAlignment={'start'}
snapToInterval={100}

what you expected to happen:
I expected the scroll to stop every 100

what actually happens:
but instead kept paging at 400.

Reproduction Steps and Sample Code

    var _scrollView: ScrollView;

    return (
<ScrollView
  pagingEnabled
contentContainerStyle={{height: 400}}
  ref={(scrollView) => { _scrollView = scrollView; }}
  snapToAlignment={'start'}
  snapToInterval={100}
>
{this.state.contentArray.map((text, index) => <Text style={{height: 100} key={index} >{data}</Text>)}
</ScrollView>

Solution

Clearer documentation. And status update with the Android implementation: #1532

Additional Information

  • React Native version: "react-native": "0.40.0",
  • Platform: iOS (Android ideally)
  • Development Operating System: MacOS
  • Dev tools: Xcode and iOS emulator iPhone 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions