{"id":17157762,"url":"https://github.com/lessp/bs-react-is-visible","last_synced_at":"2025-10-15T11:21:23.181Z","repository":{"id":34844950,"uuid":"183952397","full_name":"lessp/bs-react-is-visible","owner":"lessp","description":"A small library that lets you know whether a component is visible on screen or not.","archived":false,"fork":false,"pushed_at":"2023-01-03T20:36:26.000Z","size":1340,"stargazers_count":15,"open_issues_count":19,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-31T01:55:46.664Z","etag":null,"topics":["intersection-observer","reason-react","reasonml","visibility"],"latest_commit_sha":null,"homepage":null,"language":"Reason","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/lessp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-04-28T19:54:50.000Z","updated_at":"2023-08-22T15:35:31.000Z","dependencies_parsed_at":"2023-01-15T09:32:25.201Z","dependency_job_id":null,"html_url":"https://github.com/lessp/bs-react-is-visible","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/lessp/bs-react-is-visible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessp%2Fbs-react-is-visible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessp%2Fbs-react-is-visible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessp%2Fbs-react-is-visible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessp%2Fbs-react-is-visible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lessp","download_url":"https://codeload.github.com/lessp/bs-react-is-visible/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessp%2Fbs-react-is-visible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268831074,"owners_count":24314137,"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","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["intersection-observer","reason-react","reasonml","visibility"],"created_at":"2024-10-14T22:09:43.300Z","updated_at":"2025-10-15T11:21:18.154Z","avatar_url":"https://github.com/lessp.png","language":"Reason","readme":"# React Is Visible for ReasonReact\n\n[![Actions Status](https://github.com/lessp/bs-react-is-visible/workflows/Master%20Release/badge.svg)](https://github.com/lessp/bs-react-is-visible/actions)\n[![npm version](https://badge.fury.io/js/bs-react-is-visible.svg)](https://badge.fury.io/js/bs-react-is-visible)\n\nA small library that lets you know whether a component is visible on screen or not.\n\nUses the [IntersectionObserver API](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver) which you may want to [polyfill](#polyfill).\n\nThis is a semi-port of my React-library [react-is-visible](https://github.com/lessp/react-is-visible) for ReasonReact.\n\n### Live Examples\n\n[https://lessp.github.io/bs-react-is-visible/](https://lessp.github.io/bs-react-is-visible/)\n\n## Installation\n\n```bash\nnpm install bs-react-is-visible\n```\n\nAdd `bs-react-is-visible` to `bs-dependencies` in `bsconfig.json`\n\n## Usage\n\n### Basic\n\n```reason\n[@react.component]\nlet make = () =\u003e {\n  let (isVisible, ref) = ReactIsVisible.useIsVisible();\n\n  \u003ch1 ref\u003e\n    {(isVisible ? \"I'm visible!\" : \"I'm not visible\") |\u003e React.string}\n  \u003c/h1\u003e;\n};\n```\n\n### With options\n\n```reason\n[@react.component]\nlet make = () =\u003e {\n  let (isVisible, ref) = ReactIsVisible.useIsVisible(~options={once: true}, ());\n\n  \u003ch1 ref\u003e\n    {(isVisible ? \"I'm triggered as visible once!\" : \"I'm not visible\") |\u003e React.string}\n  \u003c/h1\u003e;\n};\n```\n\n## Polyfill\n\n[Browser compatibility.](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Browser_compatibility)\n\nIn order to polyfill, install the [polyfill from W3C](https://github.com/w3c/IntersectionObserver/tree/master/polyfill)\n\n```bash\nnpm install intersection-observer --save\n```\n\n... and import it somewhere before using `ReactIsVisible`\n\nThe easiest way would be by doing something like:\n\n```reason\n// App.re\n[%bs.raw {| require(\"intersection-observer\") |}];\n\n[@react.component]\n// ...\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessp%2Fbs-react-is-visible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flessp%2Fbs-react-is-visible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessp%2Fbs-react-is-visible/lists"}