Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,25 @@ public void addMarker(int viewId, ReadableMap markerOptionsMap, final Promise pr
});
}



@ReactMethod
public void moveMarker(int viewId, String markerId, ReadableMap newPosition, int duration,
final Promise promise) {
UiThreadUtil.runOnUiThread(
() -> {
if (mNavViewManager.getGoogleMap(viewId) != null) {
mNavViewManager
.getFragmentForViewId(viewId)
.getMapController()
.moveMarker(markerId, newPosition.toHashMap(), duration);
promise.resolve(true);
} else {
promise.reject("NO_MAP", "Map not found for viewId: " + viewId);
}
});
}

@ReactMethod
public void addPolyline(int viewId, ReadableMap polylineOptionsMap, final Promise promise) {
UiThreadUtil.runOnUiThread(
Expand Down Expand Up @@ -233,6 +252,28 @@ public void addGroundOverlay(int viewId, ReadableMap overlayOptionsMap, final Pr
});
}

@ReactMethod
public void addTextMarker(int viewId, ReadableMap textMarkerOptionsMap, final Promise promise) {
UiThreadUtil.runOnUiThread(
() -> {
if (mNavViewManager.getGoogleMap(viewId) == null) {
promise.reject(JsErrors.NO_MAP_ERROR_CODE, JsErrors.NO_MAP_ERROR_MESSAGE);
return;
}
Marker textMarker =
mNavViewManager
.getFragmentForViewId(viewId)
.getMapController()
.addTextMarker(textMarkerOptionsMap.toHashMap());

if (textMarker != null) {
promise.resolve(ObjectTranslationUtil.getMapFromMarker(textMarker));
} else {
promise.reject("TEXT_MARKER_ERROR", "Failed to create text marker");
}
});
}

@Override
public boolean canOverrideExistingModule() {
return true;
Expand Down
2 changes: 2 additions & 0 deletions ios/react-native-navigation-sdk/NavViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ typedef void (^OnArrayResult)(NSArray *_Nullable result);
- (void)addGroundOverlay:(NSDictionary *)overlayOptions result:(OnDictionaryResult)completionBlock;
- (void)addCircle:(NSDictionary *)circleOptions result:(OnDictionaryResult)completionBlock;
- (void)addMarker:(NSDictionary *)markerOptions result:(OnDictionaryResult)completionBlock;
- (void)addTextMarker:(NSDictionary *)textMarkerOptions result:(OnDictionaryResult)completionBlock;
- (void)moveMarker:(NSString *)markerId newPosition:(NSDictionary *)newPosition duration:(NSInteger)duration;
- (void)addPolygon:(NSDictionary *)polygonOptions result:(OnDictionaryResult)completionBlock;
- (void)addPolyline:(NSDictionary *)options result:(OnDictionaryResult)completionBlock;
- (GMSMapView *)mapView;
Expand Down
Loading