Skip to content

Geolocation watchPosition update rate #21061

Closed
@davidwwu

Description

@davidwwu

Environment

React Native Environment Info:
  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 4.02 GB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.1.0 - /usr/local/bin/node
    npm: 6.0.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
  IDEs:
    Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.5.0 => 16.5.0
    react-native: 0.57.0 => 0.57.0
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1

Description

I'm making a generic google map (for now) with live user location:

navigator.geolocation.watchPosition(
  ({coords}) => {
    const {latitude, longitude} = coords

    this.setState({
      position: {
        latitude,
        longitude,
      },
      region: {
        latitude,
        longitude,
        latitudeDelta: 0.0922,
        longitudeDelta: 0.0421,
      }
    })
  },
  (error) => alert(JSON.stringify(error)),
  {enableHighAccuracy: true, timeout: 20000, maximumAge: 0, distanceFilter: 0}
)

However, the current position's update rate is very slow--at about 5-8 second/update.

I'm not entirely sure if this is a bug or an expected behavior, but I've built a similar app using ionic + google map javascript api and the update rate is real-time, so I don't think this 5-8 second/update rate is normal.

Reproducible Demo

Please check out my issue branch to reproduce the app/bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: GeolocationBugStaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions