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

Add snapToInterval support for Android ScrollView #15667

Closed

Conversation

sigvef
Copy link

@sigvef sigvef commented Aug 26, 2017

This pull request adds Android support for snapToInterval in the ScrollView component (it is already implemented for iOS). I need it for a project, so I will be responsive and follow up on any comments on this pull request :)

Test Plan

The code change is pretty minimal, so it should be easy to reason about. I made a quick bare-bones test project with react-native init and tested it in an android emulator.

The test project code:

export default class ScrollViewTest extends Component {
  render() {
    const width = Dimensions.get('window').width - 32;
    return (
        <ScrollView
          horizontal={true}
          pagingEnabled={true}
          snapToInterval={width}
          >
          <Text style={{width, backgroundColor: 'red'}}>
            Welcome to React Native!
          </Text>
          <Text style={{width, backgroundColor: 'green'}}>
            To get started, edit index.android.js
          </Text>
          <Text style={{width, backgroundColor: 'blue'}}>
            Double tap R on your keyboard to reload,{'\n'}
            Shake or press menu button for dev menu
          </Text>
        </ScrollView>
    );
  }
}

A video of it running:
snaptointerval

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Aug 26, 2017
@sigvef sigvef force-pushed the Android-ScrollView-snapToInterval branch from a76a35d to 25aac4f Compare August 26, 2017 21:04
@sigvef
Copy link
Author

sigvef commented Aug 26, 2017

(fwiw, the builds are failing because master is red atm)

@henrikra
Copy link

I have already done PR about this #15297

@sigvef
Copy link
Author

sigvef commented Aug 27, 2017

Nice! Hope this means that we can get this feature soon :)

@sigvef sigvef force-pushed the Android-ScrollView-snapToInterval branch from 25aac4f to 0d4ed33 Compare August 29, 2017 14:24
@facebook-github-bot
Copy link
Contributor

@sigvef I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@ghost
Copy link

ghost commented Dec 17, 2017

Hey! I'm willing to do anything at all to help along this PR from August being merged before 2017 is gone forever and 2018 rolls around. Please let me know if there's anything I can do to help.

@sigvef
Copy link
Author

sigvef commented Feb 7, 2018

This feature has now been implemented in ddd65f1, and landed in RN 0.53.

@sigvef sigvef closed this Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants