question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UserLocation onUpdate prop doesn't work with native render mode

See original GitHub issue

Describe the bug UserLocation.onUpdate prop doesn’t work with renderMode="native". (same iOS / Android)

To Reproduce Easy to reproduce, switch “normal” and “native” to see the difference (logged by onLocationUpdate). Normal mode is always sending user location and never native mode.

Example:

import React from 'react';
import MapboxGL, {
    MapView,
    UserLocation
} from '@react-native-mapbox-gl/maps';

class BugReportUserLocation extends React.Component {

    onLocationUpdate = (event) => {
        console.log("On Location Update: " + event.coords.latitude + ", " + event.coords.longitude);
    }

    render() {
        return (
            <MapView style={{flex: 1}}>
                <UserLocation renderMode={'native'} visible onUpdate={this.onLocationUpdate}/>
            </MapView>
        );
    }
}

export default BugReportUserLocation

Expected behavior User location should be logged from the first NativeUserLocation render like renderMode="normal"

Versions:

  • Platform: iOS (same bug on Android)
  • Device: iPhoneXS
  • Emulator/ Simulator: no
  • OS: 13.4.1
  • react-native-mapbox-gl Version: 8.1.0-beta.1
  • React Native Version: 0.62.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
RobertSasakcommented, Jan 8, 2021

@ferdicus Thank you for your nice summary. I think it was ment to be optimalisation. In native mode we are not showing custom marker and therefor do not need to run LocationManager. upUpdate got simple forgotten.

0reactions
ferdicuscommented, Jan 12, 2021

resolved by #1135

Read more comments on GitHub >

github_iconTop Results From Across the Web

UserLocation onUpdate prop doesn't work with native render ...
Describe the bug UserLocation.onUpdate prop doesn't work with renderMode="native". (same iOS / Android) To Reproduce Easy to reproduce, ...
Read more >
Why would a react-native view not update after render has ...
I have a component DeckListView which I navigate to after updating state with redux. When I use the debugger in chrome I can...
Read more >
Render Props - React
The term “render prop” refers to a technique for sharing code between React components using a prop whose value is a function. A...
Read more >
How to use the Geolocation API in a React Native app
The Geolocation API returns different methods such as getCurrentPosition to get the current location and watchPosition to subscribe to location updates. They ...
Read more >
Documentation - SolidJS · Reactive Javascript Library
If you want to store a function in a Signal you must use the function form: ... Useful for setting default props for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found