{"id":28409524,"url":"https://github.com/hasanalyazidi/react-native-sectionlist-sidebar","last_synced_at":"2025-06-25T00:31:13.239Z","repository":{"id":57339846,"uuid":"165792353","full_name":"HasanAlyazidi/react-native-sectionlist-sidebar","owner":"HasanAlyazidi","description":"SectionList with sidebar to jump to sections","archived":false,"fork":false,"pushed_at":"2020-01-30T09:08:21.000Z","size":9,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-23T06:09:09.080Z","etag":null,"topics":["android","ios","react-native","sectionlist"],"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/HasanAlyazidi.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":"2019-01-15T05:43:46.000Z","updated_at":"2022-01-25T21:56:38.000Z","dependencies_parsed_at":"2022-09-16T13:00:20.122Z","dependency_job_id":null,"html_url":"https://github.com/HasanAlyazidi/react-native-sectionlist-sidebar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HasanAlyazidi/react-native-sectionlist-sidebar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HasanAlyazidi%2Freact-native-sectionlist-sidebar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HasanAlyazidi%2Freact-native-sectionlist-sidebar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HasanAlyazidi%2Freact-native-sectionlist-sidebar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HasanAlyazidi%2Freact-native-sectionlist-sidebar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HasanAlyazidi","download_url":"https://codeload.github.com/HasanAlyazidi/react-native-sectionlist-sidebar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HasanAlyazidi%2Freact-native-sectionlist-sidebar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261782086,"owners_count":23208901,"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":["android","ios","react-native","sectionlist"],"created_at":"2025-06-02T09:13:10.459Z","updated_at":"2025-06-25T00:31:13.224Z","avatar_url":"https://github.com/HasanAlyazidi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SectionList with Sidebar\n\nSectionList with sidebar to jump to sections\n\n![SectionList-array-of-strings](https://user-images.githubusercontent.com/7901330/51170468-393ea780-18b7-11e9-941d-b346566b49fc.gif)\n![SectionList-array-of-objects](https://user-images.githubusercontent.com/7901330/51170632-8fabe600-18b7-11e9-84af-fe6ed25abebb.gif)\n\n## Installation\n\n```sh\n$ npm i react-native-sectionlist-sidebar\n```\n\nor\n\n```sh\n$ yarn add react-native-sectionlist-sidebar\n```\n\n## Usage\n\n### 1. Import the component\n\n```js\nimport SectionListSidebar from 'react-native-sectionlist-sidebar'\n```\n\n### 2. Embed the component\n\n```js\nclass App extends React.Component {\n  render() {\n    return (\n      \u003cSectionListSidebar\n        ...\n      /\u003e\n    )\n  }\n}\n```\n\n### 3. Pass properties to the component\n\n## Properties\n\n| Property                  | Type             | Description                           | Required | Default        |\n|---------------------------|------------------|---------------------------------------|----------|----------------|\n| data                      | array \u003c object \u003e | Sections data                         | Yes      |                |\n| renderItem                | function         | Returns section list item component   | Yes      |                |\n| itemHeight                | number           | Section's list item height            | Yes      |                |\n| sectionHeaderHeight       | number           | Section's header height               | No       | 22             |\n| sectionFooterHeight       | number           | Section's footer height               | No       | 0              |\n| separatorHeight           | number           | Section's list item serparator height | No       | 0              |\n| listHeaderHeight          | number           | SectionList top header height         | No       | 0              |\n| sectionHeaderTextStyle    | object           | Section's list item text style        | No       | { height: 22 } |\n| renderSidebarItem         | function         | Returns sidebar's item component      | No       |                |\n| sidebarContainerStyle     | object           | Sidebar's container style             | No       | { width: 30 }  |\n| sidebarItemContainerStyle | object           | Sidebar's item container style        | No       |                |\n| sidebarItemTextStyle      | object           | Sidebar's item text style             | No       |                |\n| containerStyle            | object           | SectionListSidebar component's style  | No       |                |\n| rtl                       | boolean          | Reverse layout if set to true         | No       | false          |\n\nAnd all the optional props of `\u003cSectionList /\u003e`. You can find them [here](https://facebook.github.io/react-native/docs/sectionlist#props).\n\n## Examples\n\n### Minimal example\n```js\nimport React from 'react'\nimport { Text } from 'react-native'\nimport SectionListSidebar from 'react-native-sectionlist-sidebar'\n\nexport default class MinimalExampleScreen extends React.Component {\n  render() {\n    return (\n      \u003cSectionListSidebar\n        data={[{ key: 'A', title: 'A', data: ['Aaron', 'Ali'] }]}\n        renderItem={({ item }) =\u003e \u003cText key={item.key}\u003e{item}\u003c/Text\u003e}\n        itemHeight={30}\n      /\u003e\n    )\n  }\n}\n```\n\n* **`key`**: section's sidebar item title, `string`\n* **`title`**: section's title, `string`\n* **`data`**: section's data, `[{}]` or `string`\n\n### Custom section header component\n```js\n  renderSectionHeader = ({ section }) =\u003e (\n    \u003cView style={{ height: 30, backgroundColor: 'lightgray' }}\u003e\n      \u003cImage /\u003e\n      \u003cText\u003e{section.title}\u003c/Text\u003e\n    \u003c/View\u003e\n  );\n\n  ...\n\n  \u003cSectionListSidebar\n    renderSectionHeader={this.renderSectionHeader}\n    sectionHeaderHeight={30}\n    ...\n  /\u003e\n```\n\n\u003e Use `renderSectionHeader` only if you need to add components to the section headers. For simple headers use `sectionHeaderTextStyle`.\n\n\u003e `sectionHeaderHeight` must be equal to section header's height with top and bottom margins, paddings, and borders.\n\n### Custom sidebar item component\n```js\n  renderSidebarItem = ({ item, index }) =\u003e (\n    \u003cTouchableOpacity\n      onPress={() =\u003e { this.sectionListSidebar.jumpToSection(index); }}\n      style={{ marginVertical: 4, backgroundColor: 'lightgray' }}\u003e\n      \u003cText style={{ padding: 10, color: 'black', textAlign: 'center' }}\u003e{item}\u003c/Text\u003e\n    \u003c/TouchableOpacity\u003e\n  );\n\n  ...\n\n  \u003cSectionListSidebar\n    ref={ref =\u003e { this.sectionListSidebar = ref; }}\n    renderSidebarItem={this.renderSidebarItem}\n    ...\n  /\u003e\n```\n\n\u003e Use `renderSidebarItem` only if you need to fire a function before/after humping to section and/or add components to sidebar items. You may try accomplishing what you want using `sidebarItemContainerStyle` and `sidebarItemTextStyle` props first, and if you failed, use `renderSidebarItem`.\n\n### More examples\n* Names example with array of strings. [array-of-strings-example.js](https://github.com/HasanAlyazidi/react-native-sectionlist-sidebar/blob/master/examples/array-of-strings-example.js)\n\n![SectionList-array-of-strings](https://user-images.githubusercontent.com/7901330/51171252-12817080-18b9-11e9-94bf-dd1ccb649206.png)\n\n\n* Months example with array of objects. [array-of-objects-example.js](https://github.com/HasanAlyazidi/react-native-sectionlist-sidebar/blob/master/examples/array-of-objects-example.js)\n\n![SectionList-array-of-strings](https://user-images.githubusercontent.com/7901330/51171355-5d02ed00-18b9-11e9-9682-0bcfc5dd2339.png)\n\n## TODO\n- [X] Custom sidebar component\n- [X] Add RTL support\n- [X] Add more examples\n- [ ] Mark selected sidebar item\n- [ ] Add Tests\n- [ ] Your suggestion!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasanalyazidi%2Freact-native-sectionlist-sidebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasanalyazidi%2Freact-native-sectionlist-sidebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasanalyazidi%2Freact-native-sectionlist-sidebar/lists"}