Code Monkey home page Code Monkey logo

react-native-mapbox-gl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-mapbox-gl's Issues

Offline Support

It would be a great addition to have offline support, i.e. caching certain regions on first app start (or bundle them?) and then using them if the user is not connected to a network.

I'm not sure if this is possible, or too much effort, but I'd love that.

Add Line/Shape Example

We're looking into how to draw lines for routing, but there doesn't seem to be an example. This would be extremely helpful.

react-native 0.5.0

Hey,

I'm currently working on a project using react-native 0.5.0, which obviously isn't ^0.4.3. Any ideas if/when this module will be usable with 0.5.0?

Cheers!

selectAnnotationAnimated not working in onUpdateUserLocation

I'm having a lot of trouble firing off selectAnnotationAnimated in the onUpdateUserLocation. I'm not trying to do anything crazy, just open up an annotation when the user is close to a point. It gives me EXC_BAD_ACCESS errors. Here is some code:

  onUpdateUserLocation(location) {
    var current_lat = location.latitude;
    var current_long = location.longitude;
    this.setCenterCoordinateAnimated(mapRef, current_lat, current_long);
    var locations = this.getInitialState();
    var locations = locations.annotations;

    for (var i = 0; i < locations.length; i++) {
        var distance_from_point = this.distance(current_lat, current_long, locations[i].latitude, locations[i].longitude)
        if (distance_from_point < .01) {
            // you are close to a pin on the map, so do something
            this.selectAnnotationAnimated(mapRef, i);
        }
    }
  }

Other methods seem to work just fine. Anyone have any idea why I'm having issues with this one? I've barely modified the example, so there's not much going on here that isn't going on there.

Simple install

The ideal install for this module is:

npm install --save react-native-mapbox-gl

This should install the node module, load the mapbox gl native dependency, and compile it so you can immediately require('react-native-mapbox-gl'). Let's figure out what needs to happen to get there.

Setting a coordinates to jump to

Wondering if a property already exists to jump to a location or specific coordinates. I want to add a search bar at the top where a user can enter coordinates and the map will jump to them. If its not already implemented i would like to help but need some guidance :)

Setting marker indicators

It would be nice if i could pass an array of objects that specified coordinates, a name, icon, etc. to display markers. I'd love to be able to show markers for search results. Let me know if i can help :)

Add +1 addons

  • turf
  • geocoding
  • routing

I'm thinking that these ship with the module instead of having them be separate dependencies/repos.

Annotations disappear when popped back to view

When I have a view with a mapview, and I push another view on top of it with the navigator, if I pop back to the view containing the mapview, all annotations are gone.

Only thing I see in xcode's logs is: Can't find sprite named 'com.mapbox.sprites.marker0', 'marker0' being one the ids of my annotations.

Updating user-location in background

I've created a sophisticated background-geolocation plugin (ported from my popular Cordova plugin which intelligently monitors the user's movement-state and only engages locationManager when device is determined to be moving (and stops locationManager when the device has stopped).

Because my plugin sets NSLocationAlwaysUsageDescription, react-native-mapbox-gl will keep locationManager updating the location even when the device goes to the background, which kills the battery in a short time, of course. This is what my plugin resolves.

In spite of what this link says.

How does background location data affect device battery usage? We determined that background
location data is not a significant hit to the battery through extensive testing. You can read about how we
tested the battery on the blog.

After over 2 years experience creating Android/iOS background geolocation code, keeping locationManager always running in background WILL certainly kill the battery in a very short time.

This is what my plugin resolves.

A simple (very raw) solution in RCTMapboxGL.m goes like this:

- (void)createMap
{
    [MGLAccountManager setAccessToken:_accessToken];
    _map = [[MGLMapView alloc] initWithFrame:self.bounds styleURL:_styleURL];
    _map.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    _map.delegate = self;
    _map.userTrackingMode = MGLUserTrackingModeFollow;
    [self updateMap];
    [self addSubview:_map];
    [self layoutSubviews];

    // Solution:  Listen to pause/resume events so we can start/stop locationManager
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSuspend:) name:UIApplicationDidEnterBackgroundNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume:) name:UIApplicationWillEnterForegroundNotification object:nil];
}

- (void) onSuspend:(NSNotification*)notification
{
    // Stop updating location.  
   _map.showsUserLocation = NO;
}
- (void) onResume:(NSNotification*)notification
{
     // Restore updating locations
    _map.showsUserLocation = YES;
}

Thoughts?

Set the map view size properly

Right now, the UIView is set to 100% the height and width. This is accomplished by:

CGFloat width = [UIScreen mainScreen].bounds.size.width;
CGFloat height = [UIScreen mainScreen].bounds.size.height;
CGRect windowFrame = CGRectMake(0, 0, width, height);

MGLMapView *map = [[RCTMapboxGL alloc] initWithFrame:windowFrame accessToken:@"placeHolder"];
map.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
map.clipsToBounds = YES;

code

There is an issue with this method: if the map is not set to 100% the screen width and height, markers and marker popups are shifted by the difference in the screen height and/or width minus the actual screen width and or height. Example:
ios simulator screen shot may 10 2015 10 04 54 am

Possible Solutions:

  1. Wait until the <MapboxGLView /> has been added, then set the map height and width to this size
  2. Listen for resize events, resize the map accordingly
  3. Does UIView have some sort of ViewDidLoad event? Listen for this, get bounds
  4. ?

Setting MGLMapView *map = [[RCTMapboxGL alloc] initWithFrame:self.window.bounds accessToken:@"placeHolder"]; fails with the following error:

Failed: Current draw framebuffer is invalid.
libc++abi.dylib: terminating with uncaught exception of type mbgl::util::ShaderException: Program plain failed to link: Validation Failed: Current draw framebuffer is invalid.

Update annotation image

I'm trying to update an annotation's image when it is selected.

So I added a onTapAnnotation handler, but when I try to update the state of my react view, it breaks complaining that I'm trying to mutate an immutable object.

cleanup readme

It's a little large right now. I think the readme should have an overview of the project then link to separate install.md and api.md files.

database is locked

Every load encounters a [ERROR] [Database](5): database is locked. I think this has to do with #5

Map not rendered

I'm trying out the example code in the README, seems to work except that the map doesn't render. No errors in the console. Any ideas?

image

Marker shifted

If the map view is not full screen, markers are shifted north by the difference in the the map size to the size of the screen.

This has to do with the way the map size is calculated and not refreshed in mapbox-gl.

the user location should be cupertino here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.