Code Monkey home page Code Monkey logo

react-geolocated's Introduction

Node.js CI npm version semantic-release

react-geolocated - React hook for using Geolocation API

Demo

Basic demo can be found at the demo page.

HOC version

This package used to be a HOC, not a hook. If you want to use the HOC version, please stick with versions < 4.

Basic Usage

Install using npm:

npm install react-geolocated --save

Then use in your application like this:

import React from "react";
import { useGeolocated } from "react-geolocated";

const Demo = () => {
    const { coords, isGeolocationAvailable, isGeolocationEnabled } =
        useGeolocated({
            positionOptions: {
                enableHighAccuracy: false,
            },
            userDecisionTimeout: 5000,
        });

    return !isGeolocationAvailable ? (
        <div>Your browser does not support Geolocation</div>
    ) : !isGeolocationEnabled ? (
        <div>Geolocation is not enabled</div>
    ) : coords ? (
        <table>
            <tbody>
                <tr>
                    <td>latitude</td>
                    <td>{coords.latitude}</td>
                </tr>
                <tr>
                    <td>longitude</td>
                    <td>{coords.longitude}</td>
                </tr>
                <tr>
                    <td>altitude</td>
                    <td>{coords.altitude}</td>
                </tr>
                <tr>
                    <td>heading</td>
                    <td>{coords.heading}</td>
                </tr>
                <tr>
                    <td>speed</td>
                    <td>{coords.speed}</td>
                </tr>
            </tbody>
        </table>
    ) : (
        <div>Getting the location data&hellip; </div>
    );
};

export default Demo;

Hook return value

The values returned from the hook are:

{
    coords: {
        latitude,
        longitude,
        altitude,
        accuracy,
        altitudeAccuracy,
        heading,
        speed,
    },
    timestamp, // timestamp of when the last position was retrieved
    isGeolocationAvailable, // boolean flag indicating that the browser supports the Geolocation API
    isGeolocationEnabled, // boolean flag indicating that the user has allowed the use of the Geolocation API
    positionError, // object with the error returned from the Geolocation API call
    getPosition, // a callback you can use to trigger the location query manually
}

The coords value is equivalent to the Coordinates object and the positionError is equivalent to the PositionError.

Configuration

The useGeolocated hook takes optional configuration parameter:

{
    positionOptions: {
        enableHighAccuracy: true,
        maximumAge: 0,
        timeout: Infinity,
    },
    watchPosition: false,
    userDecisionTimeout: null,
    suppressLocationOnMount: false,
    geolocationProvider: navigator.geolocation,
    isOptimisticGeolocationEnabled: true,
    watchLocationPermissionChange: false,
    onError,
    onSuccess,
}

The positionOptions object corresponds to the PositionOptions of the Geolocation API.

By default the hook only sets position once. To watch the user's position and provide live updates to position, set watchPosition = true. The geolocation event handler is unregistered when the hook unmounts.

If set, the userDecisionTimeout determines how much time (in milliseconds) we give the user to make the decision whether to allow to share their location or not. In Firefox, if the user declines to use their location, the Geolocation API call does not end with an error. Therefore we want to fallback to the error state if the user declines and the API does not tell us.

The location is obtained when the hook mounts by default. If you want to prevent this and get the location later, set the suppressLocationOnMount to true and use the getPosition function returned by the hook to trigger the geolocation query manually.

The geolocationProvider allows to specify alternative source of the geolocation API. This was added mainly for testing purposes, however feel free to use it if need be.

The isOptimisticGeolocationEnabled allows you to set the default value of isGeolocationEnabled. By default it is true, which means isGeolocationEnabled will be true on first render. There may be cases where you don't want to assume that the user will give permission, ie you want the first value to for isGeolocationEnabled to be false. In that case, you can set isOptimisticGeolocationEnabled to false.

The watchLocationPermissionChange allows you to watch for changes in the geolocation permissions on browsers that support the permissions API. When set to true, the hook will set a watch on the geolocation permission so that when this permission changes, the location will be obtained again unless the suppressLocationOnMount is also set to true.

The onError callback is called when the geolocation query fails or when the time for the user decision passes. The onSuccess is called when the geolocation query succeeds.

Browser support

The package supports all the browsers with ES6 support (i.e. any modern browser). If you need to support IE11, stick to version < 4 of this package.

Acknowledgements

Many thanks belong to @mcumpl for the original idea for this as well as many suggestions and comments.

This project uses the react-component-boilerplate.

License

react-geolocated is available under MIT. See LICENSE for more details.

react-geolocated's People

Contributors

chulanovskyi avatar codeocelot avatar danbtl avatar dependabot-preview[bot] avatar dependabot[bot] avatar giautm avatar greenkeeper[bot] avatar greenkeeperio-bot avatar mfaheemakhtar avatar no23reason avatar patneedham avatar tyleraadams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-geolocated's Issues

An in-range update of babel-plugin-transform-object-rest-spread is breaking the build 🚨

Version 6.26.0 of babel-plugin-transform-object-rest-spread just got published.

Branch Build failing 🚨
Dependency babel-plugin-transform-object-rest-spread
Current Version 6.23.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-plugin-transform-object-rest-spread is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...0364a91 Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of react is breaking the build 🚨

Version 15.6.1 of react just got published.

Branch Build failing 🚨
Dependency react
Current Version 15.6.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies No failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-jest is breaking the build 🚨

Version 21.0.2 of babel-jest just got published.

Branch Build failing 🚨
Dependency babel-jest
Current Version 21.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-jest is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

onLocationChange event?

I was wondering if this component supports some sort of onLocationChange event which I could update my app's state with when the user changes location? Or would some sort of setInterval be the way to go?

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepo:

    • The devDependency react was updated from 16.6.1 to 16.6.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

Version 4.4.0 of eslint just got published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies 1 failing dependency. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing b8d2c50...a8455c5 Details
  • codecov/project 91.89% remains the same compared to b8d2c50 Details

Release Notes v4.4.0
  • 89196fd Upgrade: Espree to 3.5.0 (#9074) (Gyandeep Singh)
  • b3e4598 Fix: clarify AST and don't use node.start/node.end (fixes #8956) (#8984) (Toru Nagashima)
  • 62911e4 Update: Add ImportDeclaration option to indent rule (#8955) (David Irvine)
  • de75f9b Chore: enable object-curly-newline & object-property-newline.(fixes #9042) (#9068) (薛定谔的猫)
  • 5ae8458 Docs: fix typo in object-shorthand.md (#9066) (Jon Berry)
  • c3d5b39 Docs: clarify options descriptions (fixes #8875) (#9060) (Brandon Mailhiot)
  • 37158c5 Docs: clarified behavior of globalReturn option (fixes #8953) (#9058) (Brandon Mailhiot)
  • c2f3553 Docs: Update example for MemberExpression option of indent (fixes #9056) (#9057) (Jeff)
  • 78a85e0 Fix: no-extra-parens incorrectly reports async function expressions (#9035) (薛定谔的猫)
  • c794f86 Fix: getter-return reporting method named 'get' (fixes #8919) (#9004) (薛定谔的猫)
  • d0f78ec Docs: update rule deprecation policy (fixes #8635) (#9033) (Teddy Katz)
  • 5ab282f Fix: Print error message in bin/eslint.js (fixes #9011) (#9041) (Victor Hom)
  • 50e3cf3 Docs: Update sort-keys doc to define natural ordering (fixes #9043) (#9045) (Karan Sharma)
  • 7ecfe6a Chore: enable eslint-plugin/test-case-property-ordering (#9040) (薛定谔的猫)
  • ad32697 Upgrade: js-yaml to 3.9.1 (refs #9011) (#9044) (Teddy Katz)
  • 66c1d43 Docs: Create SUPPORT.md (#9031) (Teddy Katz)
  • 7247b6c Update: handle indentation of custom destructuring syntax (fixes #8990) (#9027) (Teddy Katz)
  • cdb82f2 Fix: padding-line-between-statements crash on semicolons after blocks (#8748) (Alexander Madyankin)
  • 3141872 Chore: remove unnecessary eslint-disable comments in codebase (#9032) (Teddy Katz)
  • 0f97279 Fix: refactor no-multi-spaces to avoid regex backtracking (fixes #9001) (#9008) (Teddy Katz)
  • b74514d Fix: refactor RuleContext to not modify report locations (fixes #8980) (#8997) (Teddy Katz)
  • 31d7fd2 Fix: inconsistent indent behavior on computed properties (fixes #8989) (#8999) (Teddy Katz)
  • 3393894 Fix: avoid reporting the entire AST for missing rules (#8998) (Teddy Katz)
  • b3b95b8 Chore: enable additional rules on ESLint codebase (#9013) (Teddy Katz)
  • 9b6c552 Upgrade: [email protected] (#9012) (薛定谔的猫)
  • acbe86a Chore: disallow .substr and .substring in favor of .slice (#9010) (Teddy Katz)
  • d0536d6 Chore: Optimizes adding Linter methods (fixes #9000) (#9007) (Sean C Denison)
  • 0a0401f Chore: fix spelling error. (#9003) (薛定谔的猫)
  • 3d020b9 Update: emit a warning for ecmaFeatures rather than throwing an error (#8974) (Teddy Katz)
  • d2f8f9f Fix: include name of invalid config in validation messages (fixes #8963) (#8973) (Teddy Katz)
  • c3ee46b Chore: fix misleading comment in RuleTester (#8995) (Teddy Katz)
Commits

The new version differs by 33 commits.

  • a113cd3 4.4.0
  • 181bd46 Build: changelog update for 4.4.0
  • 89196fd Upgrade: Espree to 3.5.0 (#9074)
  • b3e4598 Fix: clarify AST and don't use node.start/node.end (fixes #8956) (#8984)
  • 62911e4 Update: Add ImportDeclaration option to indent rule (#8955)
  • de75f9b Chore: enable object-curly-newline & object-property-newline.(fixes #9042) (#9068)
  • 5ae8458 Docs: fix typo in object-shorthand.md (#9066)
  • c3d5b39 Docs: clarify options descriptions (fixes #8875) (#9060)
  • 37158c5 Docs: clarified behavior of globalReturn option (fixes #8953) (#9058)
  • c2f3553 Docs: Update example for MemberExpression option of indent (fixes #9056) (#9057)
  • 78a85e0 Fix: no-extra-parens incorrectly reports async function expressions (#9035)
  • c794f86 Fix: getter-return reporting method named 'get' (fixes #8919) (#9004)
  • d0f78ec Docs: update rule deprecation policy (fixes #8635) (#9033)
  • 5ab282f Fix: Print error message in bin/eslint.js (fixes #9011) (#9041)
  • 50e3cf3 Docs: Update sort-keys doc to define natural ordering (fixes #9043) (#9045)

There are 33 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/react is breaking the build 🚨

Version 16.4.14 of @types/react was just published.

Branch Build failing 🚨
Dependency @types/react
Current Version 16.4.13
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of webpack-dev-server is breaking the build 🚨

Version 2.10.0 of webpack-dev-server was just published.

Branch Build failing 🚨
Dependency webpack-dev-server
Current Version 2.9.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

webpack-dev-server is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v2.10.0

Version 2.10.0 adds the transpilation of the client scripts via babel to ES5 which restores backwards compatibility (that was removed in 2.8.0) to very old or out of date browsers.

Important webpack-dev-server has entered a maintenance-only mode. We won't be accepting any new features or major modifications. We'll still welcome pull requests for fixes however, and will continue to address any bugs that arise. Announcement with specifics pending.

Bugfixes

  • iOS Safari 10 bug where SockJS couldn't be found (#1238)
  • reportTime option (#1209)
  • don't mutate stats configuration (#1174)
  • enable progress from config (#1181)

Updates

  • transpile client bundles with babel (#1242)
  • dependency updates (ce30460)
  • Increase minimum marked version for ReDos vuln (#1255)
  • Update sockjs dependency to fix auditjs security vulnerability warning
Commits

The new version differs by 13 commits.

  • ca8b5aa 2.10.0 (#1258)
  • 17355f0 transpile client bundles with babel (#1242)
  • ce30460 rolling back webpack-dev-midddleware 2.0, as it's node6+
  • 00e8500 updating deps and patching as necessary
  • 082ddae maint only mode
  • c9c61f2 fix(package): Increase minimum marked version for ReDos vuln (#1255)
  • aab49de iOS Safari 10 bug where SockJS couldn't be found (#1238)
  • a168b81 feat: reportTime option (#1209)
  • 32c3ceb don't mutate stats configuration (#1174)
  • ef18fc8 Update sockjs dependency to fix auditjs security vulnerability warning (#1178)
  • 7e89442 enable progress from config (#1181)
  • e8964d1 add --progress cli test (#1182)
  • a9327e5 Fix typos (#1236)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-react is breaking the build 🚨

Version 7.2.1 of eslint-plugin-react just got published.

Branch Build failing 🚨
Dependency eslint-plugin-react
Current Version 7.2.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-react is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing b8d2c50...7d1775a Details
  • codecov/project 91.89% remains the same compared to b8d2c50 Details

Release Notes v7.2.1

Fixed

Changed

Commits

The new version differs by 11 commits.

  • 8511835 Update CHANGELOG and bump version
  • 0f6688b Merge pull request #1124 from penx/patch-1
  • ecc5d89 Fix wrapped propTypes detection (fixes #1366)
  • 4724d48 Merge pull request #1365 from DianaSuvorova/i1288
  • 6272a1d [prop types] fix an assignment to prop
  • b9bb564 Merge pull request #1358 from dustinsoftware/issue1354
  • 99fd813 Fix propTypes wrapper crash in boolean-prop-naming
  • dae6574 [Tests] use pretest to run the linter
  • 2dcb73b [Tests] fixup previous linter error
  • 5ad93b4 [Fix] forbid-prop-types: propWrapperFunctions breaks on identifiers.
  • 08f451f Update no-array-index-key.md to address issue 1123

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/react is breaking the build 🚨

The devDependency @types/react was updated from 16.4.14 to 16.4.15.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of html-webpack-plugin is breaking the build 🚨

Version 2.30.0 of html-webpack-plugin just got published.

Branch Build failing 🚨
Dependency html-webpack-plugin
Current Version 2.29.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As html-webpack-plugin is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies 1 failing dependency. Details

Commits

The new version differs by 5 commits.

  • 09a96f5 Release 2.30
  • cb15071 Uses a singleton cache to store the compilation stats (#723)
  • 6f15d18 Add manual sort mode
  • bd043db Change headReg and bodyReg to allow spaces (#709)
  • 2cc10df Release 2.29.0

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/react is breaking the build 🚨

The devDependency @types/react was updated from 16.7.22 to 16.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of babel-register is breaking the build 🚨

Version 6.26.0 of babel-register just got published.

Branch Build failing 🚨
Dependency babel-register
Current Version 6.24.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-register is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...1e5a446 Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of semantic-release is breaking the build 🚨

Version 7.0.2 of semantic-release just got published.

Branch Build failing 🚨
Dependency semantic-release
Current Version 7.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As semantic-release is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code null Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...af2f044 Details

Release Notes v7.0.2

7.0.2 (2017-08-16)

Bug Fixes

  • post: create v1.2.3 tag tag instead of branch (3f85597)

    Note that if a version was released with v7.0.1, you will run into the ENOTINHISTORY error :( To recover, follow these steps:

    1. Make sure you are on your main branch and pulled the latest changes from remote
    2. Edit the package.json file, set "version" to what ever should have been released. As an example, let's say the new version number would be 1.2.3. Save the change
    3. run npm publish to release the new version. Make sure to run any pre-publish tasks first if you have any
    4. revert the changes
    5. create a tag with git tag v1.2.3 (put in the same version as in step 2. Push the tag to GitHub with git push --tags
    6. Manually create a release for the tag

    This will fix the problem and everything will work automagically again from here on now.

Commits

The new version differs by 1 commits.

  • 0c79a9b fix(post): create git tag properly

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Warning in Server Side Rendered Setup

Hi,

in a Server Side Rendered Setup the component shows up a warning, regardless if client gets a position or not:

Warning: setState(...): Can only update a mounting component. This usually means you called setState() outside componentWillMount() on the server. This is a no-op. Please check the code for the Geolocated(MerchantSearch) component.

Can you check, if you can use the DOM before setting state?

Component's children should not be mutated.

05:57:12.132 Warning: Component's children should not be mutated.
    in td (created by Demo)
    in tr (created by Demo)
    in tbody (created by Demo)
    in table (created by Demo)
    in Demo (created by Geolocated(Demo))
    in Geolocated(Demo) (created by App)
    in div (created by App)
    in App1warning.js?:44:9warningwebpack:///./~/react/~/fbjs/lib/warning.js?:44:9handleElementwebpack:///./~/react/lib/ReactChildrenMutationWarningDevtool.js?:42:11ReactDOMUnknownPropertyDevtool.onComponentHasMountedwebpack:///./~/react/lib/ReactChildrenMutationWarningDevtool.js?:53:5emitEvent/<webpack:///./~/react/lib/ReactDebugTool.js?:30:9emitEventwebpack:///./~/react/lib/ReactDebugTool.js?:27:3ReactDebugTool.onComponentHasMountedwebpack:///./~/react/lib/ReactDebugTool.js?:254:5ReactDOMComponent.Mixin.mountComponent/callbackwebpack:///./~/react/lib/ReactDOMComponent.js?:574:18.notifyAllwebpack:///./~/react/lib/CallbackQueue.js?:67:9ON_DOM_READY_QUEUEING.closewebpack:///./~/react/lib/ReactReconcileTransaction.js?:81:5Mixin.closeAllwebpack:///./~/react/lib/Transaction.js?:204:11Mixin.performwebpack:///./~/react/lib/Transaction.js?:151:11Mixin.performwebpack:///./~/react/lib/Transaction.js?:138:13.performwebpack:///./~/react/lib/ReactUpdates.js?:90:12flushBatchedUpdateswebpack:///./~/react/lib/ReactUpdates.js?:173:7Mixin.closeAllwebpack:///./~/react/lib/Transaction.js?:204:11Mixin.performwebpack:///./~/react/lib/Transaction.js?:151:11ReactDefaultBatchingStrategy.batchedUpdateswebpack:///./~/react/lib/ReactDefaultBatchingStrategy.js?:63:7enqueueUpdatewebpack:///./~/react/lib/ReactUpdates.js?:201:5enqueueUpdatewebpack:///./~/react/lib/ReactUpdateQueue.js?:25:3ReactUpdateQueue.enqueueSetStatewebpack:///./~/react/lib/ReactUpdateQueue.js?:210:5ReactComponent.prototype.setStatewebpack:///./~/react/lib/ReactComponent.js?:64:3onPositionSuccesswebpack:///./~/react-geolocated/dist-modules/components/geolocated.js?:89:21componentDidMountwebpack:///./~/react-geolocated/dist-modules/components/geolocated.js?:102:21invokeComponentDidMountWithTimerwebpack:///./~/react/lib/ReactCompositeComponent.js?:60:3.notifyAllwebpack:///./~/react/lib/CallbackQueue.js?:67:9ON_DOM_READY_QUEUEING.closewebpack:///./~/react/lib/ReactReconcileTransaction.js?:81:5Mixin.closeAllwebpack:///./~/react/lib/Transaction.js?:204:11Mixin.performwebpack:///./~/react/lib/Transaction.js?:151:11batchedMountComponentIntoNodewebpack:///./~/react/lib/ReactMount.js?:126:3Mixin.performwebpack:///./~/react/lib/Transaction.js?:138:13ReactDefaultBatchingStrategy.batchedUpdateswebpack:///./~/react/lib/ReactDefaultBatchingStrategy.js?:63:7batchedUpdateswebpack:///./~/react/lib/ReactUpdates.js?:98:3ReactMount._renderNewRootComponentwebpack:///./~/react/lib/ReactMount.js?:285:5ReactMount._renderSubtreeIntoContainerwebpack:///./~/react/lib/ReactMount.js?:371:21ReactMount.renderwebpack:///./~/react/lib/ReactMount.js?:392:12<anonymous>webpack:///./src/index.js?:19:1<anonymous>http://localhost:3000/static/js/bundle.js:1318:2__webpack_require__http://localhost:3000/static/js/bundle.js:556:12hotCreateRequire/fnhttp://localhost:3000/static/js/bundle.js:87:20<anonymous>webpack:///multi_main?:4:18<anonymous>http://localhost:3000/static/js/bundle.js:589:2__webpack_require__http://localhost:3000/static/js/bundle.js:556:12<anonymous>http://localhost:3000/static/js/bundle.js:579:18<anonymous>http://localhost:3000/static/js/bundle.js:1:11

An in-range update of react-dom is breaking the build 🚨

Version 15.6.1 of react-dom just got published.

Branch Build failing 🚨
Dependency react-dom
Current Version 15.6.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react-dom is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code No failing files. Details
  • bitHound - Dependencies No failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-cli is breaking the build 🚨

Version 6.26.0 of babel-cli just got published.

Branch Build failing 🚨
Dependency babel-cli
Current Version 6.24.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-cli is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • bitHound - Code No failing files. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...8bafbfc Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Clean up the repository

The boilerplate used to kick-start this repo is overly complex. Things to check:

  • .npmignore
  • webpack.config
  • demo and its styles
  • dependencies

An in-range update of react is breaking the build 🚨

Version 15.5.4 of react just got published.

Branch Build failing 🚨
Dependency react
Current Version 15.5.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of react-test-renderer is breaking the build 🚨

Version 15.6.2 of react-test-renderer just got published.

Branch Build failing 🚨
Dependency react-test-renderer
Current Version 15.6.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react-test-renderer is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Event-based prompt for user location, instead of immediately on page load?

I would like there to be an option so that the browser prompt
image
does not appear right away, but instead as a result of a button click or any other user-generated action.

Can there be a function prop (with 3 callback arguments) that triggers the prompt being asked? Something like

function determineLocation() {
  this.props.showLocationPrompt(this.allowed, this.blocked, this.closed)
}
function allowed() {
  // user clicked allow (or had previously given permission to this site to access location)
}
function blocked(firstTime) {
  if (firstTime) {
    // user clicked the Block option
  } else {
    // attempt blocked because of prior blocking
  }
}
function closed() {
  // user chose neither Block or Allow, must have closed the prompt
}

For that blocked function I think including a firstTime argument is necessary (not sure how to access it from browser settings though). When I was testing on localhost, I never saw the prompt to begin with, because it turns out I had previously blocked it and only found that out after looking at the site settings in Chrome:
image

Knowing whether the location request was blocked by clicking "Block" or due to prior clicking would allow for a more appropriate response message, such as "You have blocked access to location, unable to proceed" vs "You have previously blocked access to location. Please click on Site settings -> Location -> Always allow on this site." [slightly different message depending on the browser].

An in-range update of eslint-plugin-react is breaking the build 🚨

Version 7.1.0 of eslint-plugin-react just got published.

Branch Build failing 🚨
Dependency eslint-plugin-react
Current Version 7.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-react is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Code 7 failing files. Details
  • bitHound - Dependencies No failing dependencies. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/project 91.89% remains the same compared to fb61202 Details
  • codecov/patch Coverage not affected when comparing fb61202...d4c3819 Details

Release Notes v7.1.0

Added

Fixed

  • Fix prefer-stateless-function ignorePureComponents option when using class expressions (#1122 @dreid)
  • Fix void-dom-elements-no-children crash (#1195 @oliviertassinari)
  • Fix require-default-props quoted defaultProps detection (#1201)
  • Fix jsx-sort-props bug with ignoreCase and callbacksLast options set to true (#1175 @jseminck)
  • Fix no-unused-proptype false positive (#1183 #1135 @jseminck)
  • Fix jsx-no-target-blank to not issue errors for non-external URLs (#1216 @gfx)
  • Fix prop-types quoted Flow types detection (#1132 @ethanjgoldberg)
  • Fix no-array-index-key crash with key without value (#1242 @jseminck)

Changed

Commits

The new version differs by 105 commits.

  • cdfa56f Update CHANGELOG and bump version
  • 8bdb6a4 Update dependencies
  • 5be0be3 Remove re-added require-extension rule documentation
  • e7836b5 Add ESLint 4.0.0 to peerDependencies
  • 7cc380a Fix indent errors
  • 32bcb48 Merge pull request #1177 from fatfisz/curly-spacing-for-children
  • d57c115 Update the docs
  • 6903f18 Add back the support for the previous config
  • 5515130 Add more mixed tests
  • 408e1b1 Add the "children" property of the config
  • 65135b8 Fix the behavior of the boolean "attributes"
  • 7b9d9ad Change "spaces" to "when"
  • c9e9ded Allow attributes to have their own config
  • 9a8f800 Add a test case for a fixed bug
  • 0f0ab21 Move the first option into the config object

There are 105 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

Version 4.4.1 of eslint just got published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.4.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Dependencies 1 failing dependency. Details
  • bitHound - Code No failing files. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing b8d2c50...c6b67eb Details
  • codecov/project 91.89% remains the same compared to b8d2c50 Details

Release Notes v4.4.1
  • ec93614 Fix: no-multi-spaces to avoid reporting consecutive tabs (fixes #9079) (#9087) (Teddy Katz)
Commits

The new version differs by 3 commits.

  • 0d9da6d 4.4.1
  • 1ea9a6c Build: changelog update for 4.4.1
  • ec93614 Fix: no-multi-spaces to avoid reporting consecutive tabs (fixes #9079) (#9087)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Asking for permission too soon

First many thanks for this plugin! Great job :)

I do have one minor issue... The plugin seems to ask for permission on site load rather than waiting until someone has pressed a button that initiates this.props.isGeolocationAvailable. Anything I can do to get around this?

An in-range update of react-dom is breaking the build 🚨

Version 15.6.2 of react-dom just got published.

Branch Build failing 🚨
Dependency react-dom
Current Version 15.6.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react-dom is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Add Flow type declarations

With TypeScript type definitions already included and Flow being available on Windows, it makes sense to add definitions for this as well.

There should also be some kind of tests to ensure the declarations are up-to-date (similarly as in #8).

An in-range update of babel-core is breaking the build 🚨

Version 6.26.0 of babel-core just got published.

Branch Build failing 🚨
Dependency babel-core
Current Version 6.25.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-core is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • bitHound - Code No failing files. Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...12e3a50 Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Support for mobile devices

Hello,
This library works great on desktop, is there any way to make it work for ios and android devices? I tested on both and it doesn't seem to work.
Thanks!

An in-range update of webpack-dev-server is breaking the build 🚨

Version 2.7.0 of webpack-dev-server just got published.

Branch Build failing 🚨
Dependency webpack-dev-server
Current Version 2.6.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As webpack-dev-server is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • bitHound - Code No failing files. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing b8d2c50...c0ed0b4 Details
  • codecov/project 91.89% remains the same compared to b8d2c50 Details

Release Notes v2.7.0

Features

  • Added Sockjs prefix config (#911)
  • Added --allowed-hosts CLI option (#1012)

Bugfixes

  • Always allow requests with IP-address as host in checkHost() (#1007)
  • Fully mute output info if quiet is set to true. (#999)
  • Set undefined openPage to empty string when open option is true
Commits

The new version differs by 6 commits.

  • 62a46a5 2.7.0
  • ccd113a Sockjs prefix config (#911)
  • 1cf4359 add --allowed-hosts CLI option (#1012)
  • 72efaab Always allow requests with IP-address as host in checkHost() (#1007)
  • 628f0a2 Fully mute output info if quiet is set to true. (#999)
  • 8207238 Set undefined openPage to empty string when open option is true (#973)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of css-loader is breaking the build 🚨

Version 0.28.5 of css-loader just got published.

Branch Build failing 🚨
Dependency css-loader
Current Version 0.28.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As css-loader is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • bitHound - Dependencies 2 failing dependencies. Details
  • bitHound - Code No failing files. Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • codecov/patch Coverage not affected when comparing 8ae8da6...c997210 Details
  • codecov/project 91.89% remains the same compared to 8ae8da6 Details

Release Notes Release v0.28.5

0.28.5 (2017-08-17)

Bug Fixes

  • match mutliple dashes (options.camelCase) (#556) (1fee601)
  • stricter [@import](https://github.com/import) tolerance (#593) (2e4ec09)
Commits

The new version differs by 10 commits.

  • e16bdeb chore(release): 0.28.5
  • 53283a1 chore: Update yarn lock file from #565
  • 2e4ec09 fix: stricter @import tolerance (#593)
  • b92c941 docs(README): Fix ExtractTextPlugin example (#590)
  • 3440d55 test: add test for escaped selector (#584)
  • eadbd47 docs(README): fix link (#579)
  • 8dafee7 chore(package): update source-list-map v0.1.7...2.0.0 (dependencies) (#565)
  • 1fee601 fix: match mutliple dashes (options.camelCase) (#556)
  • c13c467 docs(README): add localIdentName to the options table (#551)
  • c2e0934 docs(README): fix broken link (#550)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Does it work with nextjs?

Hi,

Do you have an example for using it with nextjs? To me it looks like that it won't work. Thanks!

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

how to detect ON / OFF of gps in real time

When turning GPS on or off during operation, this.props.isGeolocationEnabled is not toggled in real-time, the change in GPS status props is only available after page reload.

Maybe do a debounce on the prop, but its only available within the child..

support watchPosition()

Is there any interest in supporting geolocation.watchPosition()? It has a very similar API to getCurrentPosition() and it should be relatively painless to add support updating the component's state and de-registering the listener on componentWillUnmount.

Happy to take a stab at it if it's something you feel is appropriate for the lib.

Refactor GitHub pages

With the new support for master/docs location for GitHub pages, it is no longer desirable to maintain the separate gh-pages branch.

Also the demo page is not as clear as desired.

An in-range update of react-dom is breaking the build 🚨

Version 15.5.4 of react-dom just got published.

Branch Build failing 🚨
Dependency react-dom
Current Version 15.5.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As react-dom is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

TypeScript declarations allow consuments to set geolocated props on the HOC resulting component

In the current version of the TypeScript typings you can specify the injected props on the resulting component, i.e. you can write something like:

interface IDemoProps {
  label: string;
}

class Demo extends React.Component<IDemoProps & GeolocatedProps, {}> {
  render(): JSX.Element {
    // implementation
  }
}

const Wrapped = geolocated()(Demo);
<Wrapped
  label="Hello"
  isGeolocationAvailable={false} // this should not be possible
/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.