{"id":4142,"url":"https://github.com/expo/react-native-scrollable-mixin","last_synced_at":"2025-07-18T05:34:23.846Z","repository":{"id":30143258,"uuid":"33693396","full_name":"expo/react-native-scrollable-mixin","owner":"expo","description":"A standard interface for your scrollable React Native components, making it easier to compose components.","archived":false,"fork":false,"pushed_at":"2017-05-17T07:38:43.000Z","size":176,"stargazers_count":96,"open_issues_count":1,"forks_count":7,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-07-09T05:03:17.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/expo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-09T21:20:15.000Z","updated_at":"2025-03-29T03:16:08.000Z","dependencies_parsed_at":"2022-08-17T20:05:32.976Z","dependency_job_id":null,"html_url":"https://github.com/expo/react-native-scrollable-mixin","commit_stats":null,"previous_names":["exponentjs/react-native-scrollable-mixin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/expo/react-native-scrollable-mixin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Freact-native-scrollable-mixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Freact-native-scrollable-mixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Freact-native-scrollable-mixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Freact-native-scrollable-mixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/expo","download_url":"https://codeload.github.com/expo/react-native-scrollable-mixin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Freact-native-scrollable-mixin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265444248,"owners_count":23766423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:02.394Z","updated_at":"2025-07-18T05:34:23.806Z","avatar_url":"https://github.com/expo.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["UI"],"readme":"# ScrollableMixin [![Slack](http://slack.exponentjs.com/badge.svg)](http://slack.exponentjs.com)\n\nScrollableMixin lets your scrollable React Native components conform to a standard interface, making it easier to compose components. This lets you compose different types of ScrollView-like components while preserving the `ScrollView` API, including methods like `scrollTo`.\n\nSee [react-native-scrollable-decorator](https://github.com/exponentjs/react-native-scrollable-decorator) for the decorator version of this mixin.\n\n[![npm package](https://nodei.co/npm/react-native-scrollable-mixin.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/react-native-scrollable-mixin/)\n\n## Installation\n```\nnpm install react-native-scrollable-mixin\n```\n\n## Usage\n\nAdd ScrollableMixin to your scrollable React components and implement `getScrollResponder()`, which must return the underlying scrollable component's scroll responder.\n\n## With JavaScript classes\n\nUse `Object.assign` to copy ScrollableMixin's functions to your class's prototype as instance methods:\n\n```js\nclass InfiniteScrollView extends React.Component {\n  static propTypes = {\n    ...ScrollView.propTypes,\n    renderScrollComponent: PropTypes.func.isRequired\n  };\n\n  /**\n   * IMPORTANT: You must return the scroll responder of the underlying\n   * scrollable component from getScrollResponder() when using ScrollableMixin.\n   */\n  getScrollResponder() {\n    return this._scrollView.getScrollResponder();\n  }\n\n  setNativeProps(props) {\n    this._scrollView.setNativeProps(props);\n  }\n\n  render() {\n    let { renderScrollComponent, ...props } = this.props;\n    return React.cloneElement(renderScrollComponent(props), {\n      ref: component =\u003e { this._scrollView = component; },\n    });\n  }\n}\n\n// Mix in ScrollableMixin's methods as instance methods\nObject.assign(InfiniteScrollView.prototype, ScrollableMixin);\n```\n\n### With `React.createClass`\n\n```js\nlet ScrollableMixin = require('react-native-scrollable-mixin');\n\nlet InfiniteScrollView = React.createClass({\n  mixins: [ScrollableMixin],\n\n  propTypes: {\n    ...ScrollView.propTypes,\n    renderScrollComponent: PropTypes.func.isRequired,\n  },\n\n  /**\n   * IMPORTANT: You must return the scroll responder of the underlying\n   * scrollable component from getScrollResponder() when using ScrollableMixin.\n   */\n  getScrollResponder() {\n    return this._scrollView.getScrollResponder();\n  },\n\n  setNativeProps(props) {\n    this._scrollView.setNativeProps(props);\n  },\n\n  render() {\n    var {\n      renderScrollComponent,\n      ...props\n    } = this.props;\n    return React.cloneElement(renderScrollComponent(props), {\n      ref: component =\u003e { this._scrollView = component; },\n    });\n  },\n});\n```\n\n## Features\n\nBy mixing in ScrollableMixin, your custom component gets the `ScrollView` API. For example:\n\n```js\nclass App extends React.Component {\n  render() {\n    return (\n      \u003cListView\n        ref={component =\u003e this._scrollView = component}\n        renderScrollView={props =\u003e \u003cInfiniteScrollView {...props} /\u003e}\n        dataSource={...}\n        renderRow={...}\n      /\u003e\n    );\n  }\n\n  _scrollToTop() {\n    // By having all scrollable components conform to ScrollableMixin's\n    // standard, calling `scrollTo` on your top-level scrollable component will\n    // successfully scroll the underlying scroll view.\n    this._scrollView.scrollTo(0, 0);\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpo%2Freact-native-scrollable-mixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpo%2Freact-native-scrollable-mixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpo%2Freact-native-scrollable-mixin/lists"}