{"id":13406645,"url":"https://github.com/gorhom/react-native-sticky-item","last_synced_at":"2025-10-05T21:23:58.417Z","repository":{"id":41062336,"uuid":"260689870","full_name":"gorhom/react-native-sticky-item","owner":"gorhom","description":"An interactive sticky item inspired by Facebook Stories.","archived":false,"fork":false,"pushed_at":"2022-03-03T18:01:46.000Z","size":1560,"stargazers_count":932,"open_issues_count":5,"forks_count":49,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-11T04:23:56.981Z","etag":null,"topics":["facebook-stories","react-native","sticky-element","sticky-item"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/gorhom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"gorhom"}},"created_at":"2020-05-02T13:12:38.000Z","updated_at":"2025-05-08T16:08:03.000Z","dependencies_parsed_at":"2022-07-14T07:10:32.870Z","dependency_job_id":null,"html_url":"https://github.com/gorhom/react-native-sticky-item","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorhom%2Freact-native-sticky-item","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorhom%2Freact-native-sticky-item/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorhom%2Freact-native-sticky-item/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gorhom%2Freact-native-sticky-item/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gorhom","download_url":"https://codeload.github.com/gorhom/react-native-sticky-item/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501557,"owners_count":22081528,"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":["facebook-stories","react-native","sticky-element","sticky-item"],"created_at":"2024-07-30T19:02:35.579Z","updated_at":"2025-10-05T21:23:53.379Z","avatar_url":"https://github.com/gorhom.png","language":"TypeScript","funding_links":["https://github.com/sponsors/gorhom"],"categories":["TypeScript","Stale"],"sub_categories":["React Native \u0026 Expo"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eSticky Item\u003c/h1\u003e\n\n[![npm](https://badgen.net/npm/v/@gorhom/sticky-item)](https://www.npmjs.com/package/@gorhom/sticky-item) [![npm](https://badgen.net/npm/license/@gorhom/sticky-item)](https://www.npmjs.com/package/@gorhom/sticky-item) [![npm](https://badgen.net/npm/types/@gorhom/sticky-item)](https://www.npmjs.com/package/@gorhom/sticky-item)\n\n\u003cimg src=\"./preview.gif\"\u003e\n\nAn interactive sticky item inspired by Facebook Stories.\n\n\u003c/div\u003e\n\n---\n\n## Installation\n\n```sh\nyarn add @gorhom/sticky-item\n# or\nnpm install @gorhom/sticky-item\n```\n\n\u003e Also, you need to install [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated), [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler) \u0026 [react-native-svg](https://github.com/react-native-community/react-native-svg), and follow theirs installation instructions.\n\n## Usage\n\n```tsx\n...\nimport StickyItemFlatList from '@gorhom/sticky-item';\n\n// dummy data\nconst data = [...Array(20)]\n  .fill(0)\n  .map((_, index) =\u003e ({ id: `item-${index}` }));\n\n// configs\nconst ITEM_WIDTH = 90;\nconst ITEM_HEIGHT = 150;\nconst STICKY_ITEM_WIDTH = 24;\nconst STICKY_ITEM_HEIGHT = 24;\nconst STICKY_ITEM_BACKGROUNDS = ['#222', '#000'];\nconst SEPARATOR_SIZE = 8;\nconst BORDER_RADIUS = 10;\n\nconst StickyItemView = ({\n  x,\n  threshold,\n  itemWidth,\n  itemHeight,\n  stickyItemWidth,\n  stickyItemHeight,\n  separatorSize,\n  isRTL,\n}) =\u003e {\n\n  const amazingAnimation = {\n    // here you add your custom interactive animation\n    // based on the animated value `x`\n  }\n\n  return \u003cAnimated.View style={amazingAnimation} /\u003e\n}\n\nconst App = () =\u003e {\n  // methods\n  const handleStickyItemPress = () =\u003e Alert.alert('Sticky Item Pressed');\n\n  // render\n  const renderItem = ({ item, index}) =\u003e (\n    \u003cView\n      key={`item-${index}`}\n      style={{\n        backgroundColor: 'red',\n        width: ITEM_WIDTH,\n        height: ITEM_HEIGHT,\n      }}\n    /\u003e\n  )\n  return (\n    \u003cStickyItemFlatList\n      itemWidth={ITEM_WIDTH}\n      itemHeight={ITEM_HEIGHT}\n      separatorSize={SEPARATOR_SIZE}\n      borderRadius={BORDER_RADIUS}\n      stickyItemWidth={STICKY_ITEM_WIDTH}\n      stickyItemHeight={STICKY_ITEM_HEIGHT}\n      stickyItemBackgroundColors={STICKY_ITEM_BACKGROUNDS}\n      stickyItemContent={StickyItemView}\n      onStickyItemPress={handleStickyItemPress}\n      data={data}\n      renderItem={renderItem}\n    /\u003e\n  )\n}\n\nexport default App\n```\n\n## Props\n\n| name                         | description                                                                                                   | required | type                                                | default |\n| ---------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------- | ------- |\n| `itemWidth`                  | Item's width.                                                                                                 | YES      | number                                              |         |\n| `itemHeight`                 | Item's height.                                                                                                | YES      | number                                              |         |\n| `separatorSize`              | FlatList's separator width, \\* if you provide `ItemSeparatorComponent`, you will need to set `separatorSize`. | NO\\*     | number                                              | 10      |\n| `borderRadius`               | Item \u0026 sticky border radius.                                                                                  | NO       | number                                              | 15      |\n| `stickyItemActiveOpacity`    | Sticky item's active opacity.                                                                                 | YES      | number                                              | 0.25    |\n| `stickyItemWidth`            | Sticky item's width.                                                                                          | YES      | number                                              |         |\n| `stickyItemHeight`           | Sticky item's height.                                                                                         | YES      | number                                              |         |\n| `stickyItemBackgroundColors` | Sticky item's two background colors, one when sticky item is extended another when it's minimize.             | YES      | string[]                                            |         |\n| `stickyItemContent`          | Sticky item's content component.                                                                              | YES      | [`ReactNode`](./src/types.ts#L30)                   |         |\n| `isRTL`                      | FlatList' layout direction.                                                                                   | NO       | boolean                                             | false   |\n| `onStickyItemPress`          | Callback when sticky item gets pressed.                                                                       | NO       | function                                            |         |\n| `...FlatList Props`          | React Native FlatList props.                                                                                  | NO       | [`FlatList`](https://reactnative.dev/docs/flatlist) |         |\n\n## To Do\n\n- [ ] Write a detailed step-by-step instruction to create sticky interactive animation.\n- [ ] Add more examples.\n- [ ] Add vertical support ?.\n\n## Author\n\n- [Mo Gorhom](https://twitter.com/gorhom)\n\n## Sponsor \u0026 Support\n\nTo keep this library maintained and up-to-date please consider [sponsoring it on GitHub](https://github.com/sponsors/gorhom). Or if you are looking for a private support or help in customizing the experience, then reach out to me on Twitter [@gorhom](https://twitter.com/gorhom).\n\n## License\n\nMIT\n\n\u003ch2 id=\"built-with\"\u003eBuilt With ❤️\u003c/h2\u003e\n\n- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)\n- [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)\n- [react-native-redash](https://github.com/wcandillon/react-native-redash)\n- [react-native-svg](https://github.com/react-native-community/react-native-svg)\n- [@react-native-community/bob](https://github.com/react-native-community/bob)\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://gorhom.dev\" target=\"_blank\"\u003e\u003cimg height=\"18\" alt=\"Mo Gorhom\" src=\"./logo.png\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorhom%2Freact-native-sticky-item","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgorhom%2Freact-native-sticky-item","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgorhom%2Freact-native-sticky-item/lists"}