Skip to content

Fix native UserLocation on Android - #1284

Merged
ferdicus merged 1 commit into
rnmapbox:masterfrom
janicduplessis:native-location
Mar 19, 2021
Merged

Fix native UserLocation on Android#1284
ferdicus merged 1 commit into
rnmapbox:masterfrom
janicduplessis:native-location

Conversation

@janicduplessis

Copy link
Copy Markdown
Contributor

This fixes 2 issues I noticed with native UserLocation on Android

  • The LocationComponentManager class is not initialized properly and an exception occurs because mLocationComponent is null. This adds a missing call to the update method to make sure it is initialized before using it.

  • The location component appears underneath annotations. This is because the layer id used is out of date with newer mapbox versions. The id is now public in LocationComponentConstants so we can use that directly.

Also do some minor dead code cleanup.

return (mLocationComponent != null);
}

public void forceLocationUpdate(Location location) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

}

public void update(@NonNull Style style) {
if (mLocationComponent == null) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same code in both branches

private Context mContext = null;

// state
private @CameraMode.Mode int mCameraMode = CameraMode.NONE;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

@ferdicus
ferdicus requested a review from mfazekas March 17, 2021 19:13
@ferdicus

Copy link
Copy Markdown
Member

Thanks for your contribution @janicduplessis

@ferdicus
ferdicus merged commit 1f86f5e into rnmapbox:master Mar 19, 2021
@janicduplessis
janicduplessis deleted the native-location branch March 19, 2021 17:05
kabbi pushed a commit to OneSoil-Platform/maps that referenced this pull request Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants