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.

Follow user mode can't be set

See original GitHub issue

Bug description followUserMode="compass" changes back to null and followUserLocation to false

To Reproduce Steps to reproduce the behavior

        <Mapbox.MapView
          style={[
            styles.map,
            { height, borderRadius: theme.roundness, overflow: 'hidden' },
          ]}
          scrollEnabled={true}
          zoomEnabled={true}
          //
          pitchEnabled={true}
          rotateEnabled={false}
          //
          compassEnabled={false}
          attributionEnabled={false}
          localizeLabels={true}
          logoEnabled={false}
          styleURL={styleURL}
          mode={Mapbox.UserTrackingModes.FollowWithHeading}
        >
          <Mapbox.Camera
            followZoomLevel={config.initialZoomLevel}
            followUserLocation={true}
            followUserMode={'compass'}
            onUserTrackingModeChange={onUserTrackingModeChange}
          />

          <Mapbox.UserLocation visible animated />
        </Mapbox.MapView>
const onUserTrackingModeChange = useCallback(event => {
    event.persist()
    console.log(event)

onUserTrackingModeChange result after init

nativeEvent:
  payload:
     followUserLocation: false
     followUserMode: null
  type: "usertrackingmodechange"

Expected behavior I want to have the same view as in the Mapbox Android example Screenshot_20190814-151204

Screenshots Screenshot_20190814-152001 I get the wrong heading, no compass on the user location an no following in the rotation of the map.

Versions:

  • Platform: Android
  • Device: Oneplus A6003
  • OS: Android 9
  • React Native Version: 0.60.4

Context

UPDATE: after some digging and in RCTMGLCamera and disabling:

        MapboxMap.CancelableCallback cameraCallback = new MapboxMap.CancelableCallback() {
            @Override
            public void onCancel() {
//                mUserTrackingState = UserTrackingState.CHANGED;
            }

            @Override
            public void onFinish() {
//                mUserTrackingState = UserTrackingState.CHANGED;
            }
        };

It works! Seems like tracking change should not be changed too quick. updateUserLocationSignificantly updateUserLocationIncrementally

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
grant1842commented, Sep 4, 2019

I wanted to add that only commenting out the onFinish line for updateUserLocationSignificantly worked for me as well.

Instead of modifying the core library, I was also able to get rid of the issue by setting the followUserLocation property to a state variable that is false by default. When the map is fully rendered with my current zoom and coordinates, I set the followUserLocation state variable to true. Seems to work well so far.

state = {
    followUserLocation: false,
}
<MapboxGL.MapView
    style={styles.map}
    onDidFinishRenderingMapFully={(r) => {
        this.setState({followUserLocation: true})
    }}
>
<MapboxGL.Camera                        
    zoomLevel={16}
    followZoomLevel={16}
    followUserLocation={this.state.followUserLocation}
    followUserMode={MapboxGL.UserTrackingModes.FollowWithCourse}
/>
</MapboxGL.MapView>
0reactions
stale[bot]commented, Jan 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Follow user mode can't be set · Issue #319 · rnmapbox/maps
When the map is fully rendered with my current zoom and coordinates, I set the followUserLocation state variable to true. Seems to work...
Read more >
Unable to enter single user mode (to create Admin account)
To invoke Single User Mode afterwards, simply hold down Command-S while you turn on or restart your Mac. Windows will not boot unless...
Read more >
FIX: You cannot set a SQL Server 2012 or 2014 database to ...
Fixes an issue in which you cannot set a SQL Server 2012 or 2014 database to single-user mode if the database is read-only....
Read more >
How to Solve QuickBooks Multi-User Mode Not Working Error
A step by step guide on how to solve QuickBooks multi user mode not working error for QuickBooks desktop. Troubleshoot QuickBooks Error.
Read more >
Multi User Mode Issues - QuickBooks - Intuit
The following are some reasons for QuickBooks multi-user mode not working: QuickBooks is not installed on the server.
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