{"id":19188223,"url":"https://github.com/mathdroid/react-vr-with-awareness","last_synced_at":"2025-05-08T02:45:56.649Z","repository":{"id":57347499,"uuid":"88826249","full_name":"mathdroid/react-vr-with-awareness","owner":"mathdroid","description":"👀 HOC for creating aware components in ReactVR","archived":false,"fork":false,"pushed_at":"2017-10-13T23:22:25.000Z","size":3342,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T00:52:44.231Z","etag":null,"topics":["hoc","react","react-vr","vr"],"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/mathdroid.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":"2017-04-20T05:53:55.000Z","updated_at":"2021-10-26T04:43:42.000Z","dependencies_parsed_at":"2022-08-29T15:21:05.813Z","dependency_job_id":null,"html_url":"https://github.com/mathdroid/react-vr-with-awareness","commit_stats":null,"previous_names":["mathdroid/with-awareness"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathdroid%2Freact-vr-with-awareness","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathdroid%2Freact-vr-with-awareness/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathdroid%2Freact-vr-with-awareness/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathdroid%2Freact-vr-with-awareness/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathdroid","download_url":"https://codeload.github.com/mathdroid/react-vr-with-awareness/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989941,"owners_count":21836665,"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":["hoc","react","react-vr","vr"],"created_at":"2024-11-09T11:24:04.310Z","updated_at":"2025-05-08T02:45:56.633Z","avatar_url":"https://github.com/mathdroid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-vr-with-awareness\n👀 HOC for creating aware components in ReactVR\n\n\u003cimg src=\"./with-awareness.gif\"/\u003e\n\n## Usage\n\n```js\nimport React from \"react\";\nimport { AppRegistry, Text, View } from \"react-vr\";\n\n// import\nconst Aware, {withAwareness} = require(\"react-vr-with-awareness\");\n\n// create a component with HOC\nconst AwareFromHOC = withAwareness(beingLookedAt =\u003e (\n  \u003cText\n    style={{\n      backgroundColor: \"#777879\",\n      fontSize: 0.8,\n      fontWeight: \"400\",\n      layoutOrigin: [0.5, 0.5],\n      paddingLeft: 0.2,\n      paddingRight: 0.2,\n      textAlign: \"center\",\n      textAlignVertical: \"center\",\n      transform: [{ translate: [0, 0, -3] }]\n    }}\n  \u003e\n    {beingLookedAt ? \"Hi there!\" : \"Look at me!\"}\n  \u003c/Text\u003e\n));\n\n// or use the supplied component `Aware` with render props\nexport default class example extends React.Component {\n  render() {\n    return (\n      \u003cView\u003e\n        {/* Aware component from HOC */}\n        \u003cAwareFromHOC /\u003e\n        \n        {/* Aware component with render props */}\n        \u003cAware render={seen =\u003e (\n          \u003cText\n              style={{\n                backgroundColor: \"#777879\",\n                fontSize: 0.8,\n                fontWeight: \"400\",\n                layoutOrigin: [0.5, 0.5],\n                paddingLeft: 0.2,\n                paddingRight: 0.2,\n                textAlign: \"center\",\n                textAlignVertical: \"center\",\n                transform: [{ translate: [0, 2, -3] }]\n              }}\n            \u003e\n              {seen ? \"seen\" : \"not seen\"}\n            \u003c/Text\u003e\n        )}/\u003e\n      \u003c/View\u003e\n    );\n  }\n}\n\nAppRegistry.registerComponent(\"example\", () =\u003e example);\n```\n\n## Docs\n\n`Aware` component takes a `render` props which is a function with 1 `boolean` parameter which indicates if the component is being seen or not. The function should return a react component. This function is similar from the one used in the HOC.\n\n## License\n\nMIT. See [LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathdroid%2Freact-vr-with-awareness","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathdroid%2Freact-vr-with-awareness","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathdroid%2Freact-vr-with-awareness/lists"}