{"id":18325242,"url":"https://github.com/kanzitelli/if-component","last_synced_at":"2025-04-06T00:31:11.746Z","repository":{"id":45401727,"uuid":"337834865","full_name":"kanzitelli/if-component","owner":"kanzitelli","description":"🤏 The tiniest missing component for React (Native). Can be used as a TS starter for building components and libraries.","archived":false,"fork":false,"pushed_at":"2021-12-15T17:03:49.000Z","size":127,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T22:57:41.888Z","etag":null,"topics":["if-component","justforfun","react","react-component-boilerplate","react-component-library","react-native"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@kanzitelli/if-component","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/kanzitelli.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-02-10T19:44:06.000Z","updated_at":"2024-03-11T04:47:53.000Z","dependencies_parsed_at":"2022-07-20T15:32:16.068Z","dependency_job_id":null,"html_url":"https://github.com/kanzitelli/if-component","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanzitelli%2Fif-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanzitelli%2Fif-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanzitelli%2Fif-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanzitelli%2Fif-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanzitelli","download_url":"https://codeload.github.com/kanzitelli/if-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419597,"owners_count":20936009,"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":["if-component","justforfun","react","react-component-boilerplate","react-component-library","react-native"],"created_at":"2024-11-05T18:40:21.150Z","updated_at":"2025-04-06T00:31:10.681Z","avatar_url":"https://github.com/kanzitelli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://xxx-files.ggc.team/oss/if-component/if-component-readme.png\" width=\"100%\" title=\"Logo\"\u003e\n\n### Install it\n\n```\nyarn add @kanzitelli/if-component\n```\n\n### Use it\n\n```tsx\nimport {If} from '@kanzitelli/if-component';\n\nclass OrdersScreen = () =\u003e {\n  return (\n    \u003c\u003e\n      \u003cIf _={loading}\n      _then={\u003cLoadingIndicator /\u003e}\n      _else={\u003cSomethingElse /\u003e} /\u003e\n    \u003c/\u003e\n  )\n}\n```\n\n### Expo Web\n\nSince `if-component` uses Reanimated 2, we need its babel plugin to be applied. Expo Web doesn't transpile modules by default, so we'll need to tell it to transpile the library.\n\n1. Install `@expo/webpack-config`:\n\n```\nyarn add -D @expo/webpack-config\n```\n\n2. Create `webpack.config.js` in the root of your project:\n\n```\nconst createExpoWebpackConfigAsync = require('@expo/webpack-config')\n\nmodule.exports = async function (env, argv) {\n  const config = await createExpoWebpackConfigAsync(\n    {\n      ...env,\n      babel: { dangerouslyAddModulePathsToTranspile: ['@kanzitelli/if-component'] },\n    },\n    argv\n  )\n\n  return config\n}\n```\n\nDon't forget to add `webpack.config.js` into `tsconfig.json` under `exclude` section, if needed.\n\n### TS lib starter\n\n```bash\n\u003e git clone https://github.com/kanzitelli/if-component rn-lib\n\u003e cd rn-lib \u0026\u0026 rm -rf .git\n\u003e yarn\n```\n\nDon't forget to change your lib's name in `package.json` and check other scripts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanzitelli%2Fif-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanzitelli%2Fif-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanzitelli%2Fif-component/lists"}