Skip to content

Commit

Permalink
Merge pull request #1 from enieber/feat/update-lib
Browse files Browse the repository at this point in the history
Feat/update lib
  • Loading branch information
enieber authored Apr 22, 2022
2 parents 0c35239 + 10faa52 commit 15cb6e9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ dependencies {
provided "com.facebook.react:react-native:+"
compile "com.google.android.gms:play-services-base:10.2.4"
compile "com.google.android.gms:play-services-maps:10.2.4"
compile 'org.osmdroid:osmdroid-android:5.6.5'
compile 'org.osmdroid:osmdroid-android:6.1.11'
testCompile 'junit:junit:4.12'
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.android.gms.maps.model.LatLngBounds;

public class LatLngBoundsUtils {

public static boolean BoundsAreDifferent(LatLngBounds a, LatLngBounds b) {
LatLng centerA = a.getCenter();
double latA = centerA.latitude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.airbnb.android.react.maps.open;

import android.content.Context;

import com.facebook.react.views.view.ReactViewGroup;

import org.osmdroid.views.MapView;

public abstract class OpenAirMapFeature extends ReactViewGroup {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.osmdroid.views.MapView;

import java.util.Map;

import javax.annotation.Nullable;

public class OpenAirMapManager extends ViewGroupManager<OpenAirMapView> {
Expand All @@ -37,7 +36,9 @@ public class OpenAirMapManager extends ViewGroupManager<OpenAirMapView> {
private static final int FIT_TO_SUPPLIED_MARKERS = 6;
private static final int FIT_TO_COORDINATES = 7;
private static final int SET_MAP_BOUNDARIES = 8;

private double lat = -18.9855811
private double log = -53.7266065

private final Map<String, OnlineTileSourceBase> MAP_TYPES = MapBuilder.of(
"standard", TileSourceFactory.MAPNIK,
"satellite", TileSourceFactory.OPEN_SEAMAP
Expand All @@ -61,7 +62,7 @@ protected OpenAirMapView createViewInstance(ThemedReactContext context) {
MapView mapView = view.map;
mapView.setTileSource(TileSourceFactory.MAPNIK);
IMapController controller = mapView.getController();
GeoPoint startPoint = new GeoPoint(-18.9855811, -53.7266065);
GeoPoint startPoint = new GeoPoint(this.lat, this.log);
controller.setCenter(startPoint);
return view;
}
Expand All @@ -76,8 +77,8 @@ private void emitMapError(ThemedReactContext context, String message, String typ
error.putString("type", type);

context
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("onError", error);
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("onError", error);
}

@ReactProp(name = "region")
Expand All @@ -95,6 +96,16 @@ public void showMultiTouchControls(OpenAirMapView view, boolean hasMultiTouchCon
view.showMultiTouchControls(hasMultiTouchControls);
}

@ReactProp(name = "initalLat")
public void setIntialLat(double lat) {
this.lat = lat;
}

@ReactProp(name = "initalLog")
public void setIntialLat(double log) {
this.log = log;
}

@ReactProp(name = "initialRegion")
public void setInitialRegion(OpenAirMapView view, ReadableMap initialRegion) {
view.setInitialRegion(initialRegion);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "React Native Mapview component for Android",
"main": "index.js",
"author": "Enieber Cunha <eniebercunha@gmail.com>",
"version": "0.0.2",
"version": "0.1.0",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
Expand Down

0 comments on commit 15cb6e9

Please sign in to comment.