Skip to content

Commit

Permalink
fix: change init render componenet
Browse files Browse the repository at this point in the history
  • Loading branch information
enieber committed Apr 22, 2022
1 parent 96a50b7 commit 10faa52
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,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 @@ -60,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 @@ -75,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 @@ -94,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

0 comments on commit 10faa52

Please sign in to comment.