UserLocation onUpdate prop doesn't work with native render mode
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
resolved by #1135