<GeoLocationSensor>

Render-prop/FaCC that re-renders on device location change, uses Geolocation API.

Props

None.

Example

import {GeoLocationSensor} from 'libreact/lib/GeoLocationSensor';

<GeoLocationSensor>{(state) =>
  JSON.strinfigy(state, null 4)
}</GeoLocationSensor>

Result

{
    "accuracy": 86,
    "altitude": null,
    "altitudeAccuracy": null,
    "heading": null,
    "latitude": 54.4,
    "longitude": -0.3,
    "speed": null,
    "timestamp": 1517137742896
}

withGeoLocation() HOC

HOC that merges geoLocation prop into enhanced component's props.

import {withGeoLocation} from 'libreact/lib/GeoLocationSensor';

@withGeoLocation decorator

React stateful component decorator that adds geoLocation prop.

import {withGeoLocation} from 'libreact/lib/GeoLocationSensor';

@withGeoLocation
class MyComp extends Component {

}

results matching ""

    No results matching ""