{"id":13481630,"url":"https://github.com/tkh44/react-geolocation","last_synced_at":"2025-04-05T21:05:14.253Z","repository":{"id":66143896,"uuid":"100158114","full_name":"tkh44/react-geolocation","owner":"tkh44","description":"🌎🛰 Declarative geolocation for React","archived":false,"fork":false,"pushed_at":"2018-12-17T22:50:38.000Z","size":27,"stargazers_count":241,"open_issues_count":2,"forks_count":25,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T20:03:23.943Z","etag":null,"topics":["declarative","geolocation","react"],"latest_commit_sha":null,"homepage":"https://tkh44.github.io/react-geolocation/","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/tkh44.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-13T06:22:14.000Z","updated_at":"2024-01-19T20:31:26.000Z","dependencies_parsed_at":"2023-12-18T05:47:13.908Z","dependency_job_id":"8296481f-ce38-4f21-8789-7e20641ddf10","html_url":"https://github.com/tkh44/react-geolocation","commit_stats":{"total_commits":20,"total_committers":7,"mean_commits":2.857142857142857,"dds":"0.30000000000000004","last_synced_commit":"c9929500ce59495b47a859aaa635869793d45266"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkh44%2Freact-geolocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkh44%2Freact-geolocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkh44%2Freact-geolocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkh44%2Freact-geolocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkh44","download_url":"https://codeload.github.com/tkh44/react-geolocation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399871,"owners_count":20932876,"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":["declarative","geolocation","react"],"created_at":"2024-07-31T17:00:53.514Z","updated_at":"2025-04-05T21:05:14.235Z","avatar_url":"https://github.com/tkh44.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Misc"],"readme":"\n\n# react-geolocation\n🌎🛰 Declarative geolocation in React\n\n[![npm version](https://badge.fury.io/js/react-geolocation.svg)](https://badge.fury.io/js/react-geolocation)\n[![Build Status](https://travis-ci.org/tkh44/react-geolocation.svg?branch=master)](https://travis-ci.org/tkh44/react-geolocation)\n[![codecov](https://codecov.io/gh/tkh44/react-geolocation/branch/master/graph/badge.svg)](https://codecov.io/gh/tkh44/react-geolocation)\n\n-   [Install](#install)\n-   [Basic Usage](#basic-usage)\n-   [Props](#props)\n\n## Install\n\n```bash\nnpm install -S react-geolocation\n```\n\n## Basic Usage\n```javascript\n\u003cGeolocation\n  render={({\n    fetchingPosition,\n    position: { coords: { latitude, longitude } = {} } = {},\n    error,\n    getCurrentPosition\n  }) =\u003e\n    \u003cdiv\u003e\n      \u003cbutton onClick={getCurrentPosition}\u003eGet Position\u003c/button\u003e\n      {error \u0026\u0026\n        \u003cdiv\u003e\n          {error.message}\n        \u003c/div\u003e}\n      \u003cpre\u003e\n        latitude: {latitude}\n        longitude: {longitude}\n      \u003c/pre\u003e\n    \u003c/div\u003e}\n/\u003e\n```\n\n## Props\n\n### [enableHighAccuracy `boolean`](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/enableHighAccuracy)\n\n\n### [timeout `number`](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/timeout)\n\n\n### [maximumAge `number`](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/maximumAge)\n\n\n### render `function`\n\n`render` is a function that receives an object as its only argument.\n\nThe object contains the following keys:\n\n- fetchingPosition: `bool`\n- [position](https://developer.mozilla.org/en-US/docs/Web/API/Position): `object`\n- [error](https://developer.mozilla.org/en-US/docs/Web/API/PositionError): `object`\n- getCurrentPosition: `function`\n\n\n### lazy `boolean`\n\nIf true then the component will **not** perform the fetch on mount. \nYou must use the `getCurrentPosition` named argument in order to initiate the request.\n\n```javascript\n\u003cGeolocation \n  lazy \n  render={({getCurrentPosition, fetchingPosition}) =\u003e (\n    \u003cdiv\u003e\n      \u003cbutton onClick={getCurrentPosition}\u003eGet Current Position\u003c/button\u003e\n      \u003cdiv\u003eFetching Position: {fetchingPosition}\u003c/div\u003e\n    \u003c/div\u003e\n  )}\n/\u003e \n// renders \"Fetching Position: false\" until the button is clicked\n```\n\n\n### onSuccess `function`\n\ncallback called on success. Its only argument is `position`\n\n- https://developer.mozilla.org/en-US/docs/Web/API/Position\n\n### onError `function`\n\ncallback called on error. Its only argument is `error`\n\n- https://developer.mozilla.org/en-US/docs/Web/API/PositionError\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkh44%2Freact-geolocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkh44%2Freact-geolocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkh44%2Freact-geolocation/lists"}