Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserLocation not working on android #3192

Closed
lvothnrv opened this issue Nov 20, 2023 · 6 comments
Closed

UserLocation not working on android #3192

lvothnrv opened this issue Nov 20, 2023 · 6 comments

Comments

@lvothnrv
Copy link

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

Android

@rnmapbox/maps version

10.0.15

Standalone component to reproduce

import React from 'react';
import MapboxGL, {UserLocation} from '@rnmapbox/maps';

import {StyleSheet, StatusBar, View} from 'react-native';

MapboxGL.setAccessToken('...');

const PerimeterStep = () => {
  return (
    <View style={styles.flex1}>
      <StatusBar barStyle="light-content" animated={true} />
      <MapboxGL.MapView
        style={styles.flex1}
        styleURL={'mapbox://styles/.../...'}
        logoEnabled={false}
        attributionEnabled={false}>
        <UserLocation />
      </MapboxGL.MapView>
    </View>
  );
};

export default PerimeterStep;

const styles = StyleSheet.create({
  flex1: {
    flex: 1,
  },
});

Observed behavior and steps to reproduce

No response

Expected behavior

I was on version 10.0.0-beta.70 it worked but now it doesn't work anymore so I switched to the latest version but the same thing doesn't work..

Notes / preliminary analysis

No response

Additional links and references

No response

@AntonioA-D-C
Copy link

Having this exact same error, UserLocation crashes the app

@Cdingram
Copy link
Contributor

Cdingram commented Dec 4, 2023

Yup mine crashes too

@Cdingram
Copy link
Contributor

Cdingram commented Dec 5, 2023

FYI, I was able to make it work by using "<Mapbox.UserLocation renderMode="native" />" instead of just "<Mapbox.UserLocation />"

@mfazekas
Copy link
Contributor

mfazekas commented Dec 6, 2023

I could not reproduce the issue in our example app:

This was rendering correctly for me

import React from 'react';
import MapboxGL, { UserLocation } from '@rnmapbox/maps';
import { StyleSheet, StatusBar, View } from 'react-native';

MapboxGL.setAccessToken('...');

const PerimeterStep = () => {
  return (
    <View style={styles.flex1}>
      <StatusBar barStyle="light-content" animated={true} />
      <MapboxGL.MapView
        style={styles.flex1}
        logoEnabled={false}
        attributionEnabled={false}
      >
        <UserLocation />
      </MapboxGL.MapView>
    </View>
  );
};

export default PerimeterStep;

const styles = StyleSheet.create({
  flex1: {
    flex: 1,
  },
});

image

@mfazekas mfazekas closed this as completed Dec 6, 2023
@Cdingram
Copy link
Contributor

Interesting I’m using Mapbox not MapboxGL from the import, not sure if that makes a difference.

@mfazekas
Copy link
Contributor

Interesting I’m using Mapbox not MapboxGL from the import, not sure if that makes a difference.
@Cdingram it shouldn't make a difference.

For those it's crashing pls post the exception and backtrace.

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

No branches or pull requests

4 participants