{"id":13522918,"url":"https://github.com/showtime-xyz/showtime-tab-view","last_synced_at":"2025-04-01T00:30:27.106Z","repository":{"id":65281364,"uuid":"588678146","full_name":"showtime-xyz/showtime-tab-view","owner":"showtime-xyz","description":"A react native TabView component that support collapse header and custom refresh control, powered by Reanimated \u0026 GestureHandler. Join Showtime:","archived":false,"fork":false,"pushed_at":"2024-02-20T13:18:56.000Z","size":7047,"stargazers_count":221,"open_issues_count":7,"forks_count":22,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-07-21T17:12:14.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://showtime-xyz.notion.site/Join-Showtime-Public-fa6282938e284134b302184062d7e329","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/showtime-xyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-01-13T18:03:26.000Z","updated_at":"2024-07-14T16:57:16.000Z","dependencies_parsed_at":"2024-01-13T22:24:47.797Z","dependency_job_id":"1a028f67-f7c8-47fa-9b0d-c78f688029cf","html_url":"https://github.com/showtime-xyz/showtime-tab-view","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showtime-xyz%2Fshowtime-tab-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showtime-xyz%2Fshowtime-tab-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showtime-xyz%2Fshowtime-tab-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/showtime-xyz%2Fshowtime-tab-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/showtime-xyz","download_url":"https://codeload.github.com/showtime-xyz/showtime-tab-view/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213474233,"owners_count":15592545,"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-08-01T06:00:53.688Z","updated_at":"2024-08-01T06:05:11.258Z","avatar_url":"https://github.com/showtime-xyz.png","language":"TypeScript","funding_links":[],"categories":["Stale","Libraries"],"sub_categories":["React Native \u0026 Expo","UI Components"],"readme":"\u003cimg align=\"right\" width=\"160\" alt=\"showtime tab view logo\" src=\"./example/assets/icon.png\" /\u003e\n\u003cdiv \u003e\n  \u003ch1\u003eShowtime Tab View\u003c/h1\u003e\n\u003c/div\u003e\n\nA React Native component that supports a collapsible header and custom refresh control, powered by [Reanimated v2](https://docs.swmansion.com/react-native-reanimated/) and [GestureHandler V2](https://docs.swmansion.com/react-native-gesture-handler/docs/).\n\u003cvideo align=\"right\" width=\"160\" alt=\"This library helped you? Consider sponsoring!\" src=\"https://user-images.githubusercontent.com/37520667/212389901-764422ef-cf1b-48fc-87af-cfbe7ad1f6e2.mp4\" /\u003e\n\n## What\n\nThis is a React Native tab view component that wraps gestures and animations on top of [react-native-tab-view](https://github.com/react-navigation/react-navigation/tree/main/packages/react-native-tab-view#readme). The source code can be found [here](https://github.com/showtime-xyz/showtime-frontend/tree/staging/packages/design-system/collapsible-tab-view). You can see this [context on Twitter](https://twitter.com/alan_toa/status/1564429150152458241).\n\n## Features\n\n- Collapsible header.\n- Support for [FlashList](https://shopify.github.io/flash-list/). \\*(see [this](./example/src/tab-flash-list/index.tsx))\n- Custom refresh control.\n- Bounce effect support on iOS.\n- Support for iOS, Android, and Web.\n- Zoom header when pulling to refresh. \\*(see this [thread](https://github.com/showtime-xyz/showtime-frontend/discussions/1471))\n\n## Installation\n\nBefore installing this package, you should first follow the installation instructions for:\n\n- [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/)\n- [react-native-gesture-handler v2](https://docs.swmansion.com/react-native-gesture-handler/)\n- [react-native-pager-view](https://docs.expo.dev/versions/latest/sdk/view-pager/)\n\nFlashList is not a required dependency, but for optimal performance, it is recommended to use FlashList instead of the standard FlatList implementation\n\n- [FlashList by Shopify](https://shopify.github.io/flash-list/docs/)\n\nAnd then, you can install the package using the following command:\n\n```sh\nyarn add @showtime-xyz/tab-view\n```\n\n## Examples\n\n- [Basic Example](./example//src/example.tsx)\n- [Zoom Effect with Pull-To-Refresh](https://github.com/Daavidaviid/showtime-scrollview-with-zoom-pull-to-refresh)\n- [Showtime Profile Example](https://github.com/showtime-xyz/showtime-frontend/tree/staging/packages/app/components/profile)\n- ...more to come!\n\n## Usage\n\nThe API for this package is similar to [react-native-tab-view](https://github.com/react-navigation/react-navigation/tree/main/packages/react-native-tab-view#readme), with extended props. A basic usage example is shown below:\n\n```tsx\nimport React, { useCallback, useState } from \"react\";\nimport { StatusBar, Text, View } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\nimport { Route, TabView } from \"@showtime-xyz/tab-view\";\nimport { TabFlashList } from \"./tab-flash-list\";\nconst StatusBarHeight = StatusBar.currentHeight ?? 0;\nconst TabScene = ({ route }: any) =\u003e {\n  return (\n    \u003cTabFlashList\n      index={route.index}\n      data={new Array(20).fill(0)}\n      estimatedItemSize={60}\n      renderItem={({ index }) =\u003e {\n        return (\n          \u003cView\n            style={{\n              height: 60,\n              backgroundColor: \"#fff\",\n              marginBottom: 8,\n              justifyContent: \"center\",\n              alignItems: \"center\",\n            }}\n          \u003e\n            \u003cText\u003e{`${route.title}-Item-${index}`}\u003c/Text\u003e\n          \u003c/View\u003e\n        );\n      }}\n    /\u003e\n  );\n};\n\nexport function Example() {\n  const [isRefreshing, setIsRefreshing] = useState(false);\n  const [routes] = useState\u003cRoute[]\u003e([\n    { key: \"like\", title: \"Like\", index: 0 },\n    { key: \"owner\", title: \"Owner\", index: 1 },\n    { key: \"created\", title: \"Created\", index: 2 },\n  ]);\n  const [index, setIndex] = useState(0);\n  const animationHeaderPosition = useSharedValue(0);\n  const animationHeaderHeight = useSharedValue(0);\n\n  const renderScene = useCallback(({ route }: any) =\u003e {\n    switch (route.key) {\n      case \"like\":\n        return \u003cTabScene route={route} index={0} /\u003e;\n      case \"owner\":\n        return \u003cTabScene route={route} index={1} /\u003e;\n      case \"created\":\n        return \u003cTabScene route={route} index={2} /\u003e;\n      default:\n        return null;\n    }\n  }, []);\n\n  const onStartRefresh = async () =\u003e {\n    setIsRefreshing(true);\n    setTimeout(() =\u003e {\n      console.log(\"onStartRefresh\");\n      setIsRefreshing(false);\n    }, 300);\n  };\n  const renderHeader = () =\u003e (\n    \u003cView style={{ height: 300, backgroundColor: \"#000\" }}\u003e\u003c/View\u003e\n  );\n  return (\n    \u003cTabView\n      onStartRefresh={onStartRefresh}\n      isRefreshing={isRefreshing}\n      navigationState={{ index, routes }}\n      renderScene={renderScene}\n      onIndexChange={setIndex}\n      lazy\n      renderScrollHeader={renderHeader}\n      minHeaderHeight={44 + StatusBarHeight}\n      animationHeaderPosition={animationHeaderPosition}\n      animationHeaderHeight={animationHeaderHeight}\n    /\u003e\n  );\n}\n```\n\n## API\n\n... API documentation will be available soon. 🔜\n\n## Contributing\n\nTo learn how to contribute to this repository and understand the development workflow, please refer to the [contributing guide](CONTRIBUTING.md).\n\n## Shoutout\n\nSpecial thanks to [@Daavidaviid](https://github.com/Daavidaviid) for experimenting with the [zoom header effect with pull-to-refresh](https://github.com/showtime-xyz/showtime-frontend/discussions/1471).\n\n## License\n\nMIT\n\n---\n\nMade with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshowtime-xyz%2Fshowtime-tab-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshowtime-xyz%2Fshowtime-tab-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshowtime-xyz%2Fshowtime-tab-view/lists"}