{"id":19273968,"url":"https://github.com/rintoj/native-x-data-view","last_synced_at":"2026-05-30T16:31:45.249Z","repository":{"id":57308347,"uuid":"367306992","full_name":"rintoj/native-x-data-view","owner":"rintoj","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-17T09:20:35.000Z","size":316,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T00:53:49.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rintoj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-14T09:00:31.000Z","updated_at":"2021-09-17T09:19:30.000Z","dependencies_parsed_at":"2022-09-10T01:02:16.442Z","dependency_job_id":null,"html_url":"https://github.com/rintoj/native-x-data-view","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Fnative-x-data-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Fnative-x-data-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Fnative-x-data-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Fnative-x-data-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rintoj","download_url":"https://codeload.github.com/rintoj/native-x-data-view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240378873,"owners_count":19792039,"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-11-09T20:44:41.358Z","updated_at":"2026-05-30T16:31:45.204Z","avatar_url":"https://github.com/rintoj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# native-x-data-view\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nThis component conditionally shows data, progress or error based on the status from API. This\nwrapper component will provide consistent data handling experience in an application.\n\n## Install\n\n### Yarn\n\n```sh\nyarn add native-x-data-view\n```\n\n### NPM\n\n```sh\nnpm install native-x-data-view\n```\n\n## Usage\n\n```tsx\nimport { DataView } from 'native-x-data-view'\n\nfunction MyComponent() {\n  const { data, isLoading, error } = useAPIHook()\n  return (\n    \u003cDataView data={data} isLoading={isLoading} error={error}\u003e\n      ...\n    \u003c/Stack\u003e\n  )\n}\n```\n\n## API\n\n| Property                                                          | Default Value | Usage                                                     |\n| ----------------------------------------------------------------- | ------------- | --------------------------------------------------------- |\n| data?: T or null                                                  | -             | Data for the view                                         |\n| error?: Error or string or null                                   | false         | Error message                                             |\n| showError?: boolean                                               | true          | Show error if exists                                      |\n| showEmptyMessage?: boolean                                        | true          | Show empty message if data is empty                       |\n| showSpinner?: boolean                                             | true          | Show spinner while the data is being loaded               |\n| emptyMessage?: ReactNode or {title?: string, description: string} | true          | Configure message to show when the API returns empty data |\n\n## Configure Empty Message\n\n```tsx\nimport { DataView } from 'native-x-data-view'\n\nconst emptyMessage = {\n  title: 'No data',\n  description: 'We could not find what you are looking for'\n}\n\nfunction MyComponent() {\n  const { data, isLoading, error } = useAPIHook()\n  return (\n    \u003cDataView data={data} isLoading={isLoading} error={error} emptyMessage={emptyMessage}\u003e\n      ...\n    \u003c/Stack\u003e\n  )\n}\n```\n\nYou can also pass on a custom view as empty message\n\n```tsx\nimport { DataView } from 'native-x-data-view'\n\nfunction EmptyMessage() {\n  return \u003cView\u003e\n    \u003cText\u003eNo data\u003c/Text\u003e\n  \u003c/View\u003e\n}\n\nfunction MyComponent() {\n  const { data, isLoading, error } = useAPIHook()\n  return (\n    \u003cDataView data={data} isLoading={isLoading} error={error} emptyMessage={\u003cEmptyMessage /\u003e}\u003e\n      ...\n    \u003c/Stack\u003e\n  )\n}\n```\n\n## Configure Error Message\n\n```tsx\nimport { DataView } from 'native-x-data-view'\n\nconst renderError = (error: Error | string | null) =\u003e {\n  if (!error) {\n    return null\n  }\n  return \u003cView\u003e\n    \u003cText\u003eCustom error view: {error}\u003c/Text\u003e\n  \u003c/View\u003e\n}\n\nfunction MyComponent() {\n  const { data, isLoading, error } = useAPIHook()\n  return (\n    \u003cDataView data={data} isLoading={isLoading} error={error} renderError={renderError}\u003e\n      ...\n    \u003c/Stack\u003e\n  )\n}\n```\n\n## `ErrorMessage` component\n\n```tsx\nimport { ErrorMessage } from 'native-x-data-view'\n\nfunction MyComponent() {\n  return \u003cErrorMessage alignCenter\u003e{error}\u003c/ErrorMessage\u003e\n}\n```\n\n## `EmptyMessage` component\n\n```tsx\nimport { EmptyMessage } from 'native-x-data-view'\n\nfunction MyComponent() {\n  return (\n    \u003cEmptyMessage\n      title='No data'\n      alignLeft={false}\n      alignCenter={true}\n      alignRight={false}\n      alignTop={false}\n      alignMiddle={true}\n      alignBottom={false}\n      titleColor={COLOR.ERROR}\n      descriptionColor={COLOR.WARNING}\n    \u003e\n      {'Error description'}\n    \u003c/EmptyMessage\u003e\n  )\n}\n```\n\n## Automatic Release\n\nHere is an example of the release type that will be done based on a commit messages:\n\n| Commit message      | Release type          |\n| ------------------- | --------------------- |\n| fix: [comment]      | Patch Release         |\n| feat: [comment]     | Minor Feature Release |\n| perf: [comment]     | Major Feature Release |\n| doc: [comment]      | No Release            |\n| refactor: [comment] | No Release            |\n| chore: [comment]    | No Release            |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frintoj%2Fnative-x-data-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frintoj%2Fnative-x-data-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frintoj%2Fnative-x-data-view/lists"}