Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:
) {
withMapViewOnUIThread(viewRef, promise) {
val layerIds = ConvertUtils.toStringList(withLayerIDs)
val rectF = ConvertUtils.toRectF(withBBox)

it.queryRenderedFeaturesInRect(
ConvertUtils.toRectF(withBBox),
if (withBBox.size() == 0) null else rectF,
ExpressionParser.from(withFilter),
if (layerIds.size == 0) null else layerIds,
createCommandResponse(promise)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
}

override fun onMove(moveGestureDetector: MoveGestureDetector): Boolean {
// Stop propagation move events when scroll gesture disabled to allow moving
// route waypoints on the map
if (!mapView.gestures.scrollEnabled) return true
return mapGesture(MapGestureType.Move, moveGestureDetector)
}

Expand Down Expand Up @@ -969,8 +972,8 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
fun queryRenderedFeaturesInRect(rect: RectF?, filter: Expression?, layerIDs: List<String>?, response: CommandResponse) {
val size = mMap.getMapOptions().size
val screenBox = if (rect == null) ScreenBox(ScreenCoordinate(0.0, 0.0), ScreenCoordinate(size?.width!!.toDouble(), size?.height!!.toDouble())) else ScreenBox(
ScreenCoordinate(rect.right.toDouble(), rect.bottom.toDouble() ),
ScreenCoordinate(rect.left.toDouble(), rect.top.toDouble()),
ScreenCoordinate(rect.right.toDouble(), rect.bottom.toDouble()),
)
mMap.queryRenderedFeatures(
RenderedQueryGeometry(screenBox),
Expand Down Expand Up @@ -1168,7 +1171,8 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
val layer = style.getLayer(it.id)
if ((layer != null) && match(layer, sourceId, sourceLayerId)) {
layer.visibility(
if (visible) Visibility.VISIBLE else Visibility.NONE
// Fix for Apollo build issue caused by android-35.jar
if (visible) com.mapbox.maps.extension.style.layers.properties.generated.Visibility.VISIBLE else com.mapbox.maps.extension.style.layers.properties.generated.Visibility.NONE
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.rnmapbox.rnmbx.components.RemovalReason
import com.rnmapbox.rnmbx.utils.ExpressionParser
import java.lang.ClassCastException
import com.rnmapbox.rnmbx.utils.Logger
import com.rnmapbox.rnmbx.v11compat.layer.*

abstract class RNMBXLayer<T : Layer?>(protected var mContext: Context) : AbstractSourceConsumer(
mContext
Expand Down Expand Up @@ -95,7 +94,8 @@ abstract class RNMBXLayer<T : Layer?>(protected var mContext: Context) : Abstrac
fun setVisible(visible: Boolean) {
mVisible = visible
if (mLayer != null) {
mLayer!!.visibility(if (mVisible) Visibility.VISIBLE else Visibility.NONE)
// Fix for Apollo build issue caused by android-35.jar
mLayer!!.visibility(if (mVisible) com.mapbox.maps.extension.style.layers.properties.generated.Visibility.VISIBLE else com.mapbox.maps.extension.style.layers.properties.generated.Visibility.NONE)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class ViewTagResolver(val context: ReactApplicationContext) {
if (list != null) {
context.runOnUiQueueThread {
try {
val view = manager.resolveView(viewTag)
val view = manager?.resolveView(viewTag)

list.forEach { it.fn(view) }
} catch (err: IllegalViewOperationException) {
Expand All @@ -58,19 +58,19 @@ open class ViewTagResolver(val context: ReactApplicationContext) {
createdViews.remove(viewTag)
}

private val manager : UIManager
private val manager : UIManager?
get() =
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
UIManagerHelper.getUIManager(context, UIManagerType.FABRIC)!!
UIManagerHelper.getUIManager(context, UIManagerType.FABRIC)
} else {
UIManagerHelper.getUIManager(context, UIManagerType.DEFAULT)!!
UIManagerHelper.getUIManager(context, UIManagerType.DEFAULT)
}

// calls on UiQueueThread with resolved view
fun <V>withViewResolved(viewTag: Int, reject: Promise? = null, fn: (V) -> Unit) {
context.runOnUiQueueThread() {
try {
val resolvedView: View? = manager.resolveView(viewTag)
val resolvedView: View? = manager?.resolveView(viewTag)
val view = resolvedView as? V
if (view != null) {
fn(view)
Expand Down
5 changes: 5 additions & 0 deletions ios/RNMBX/RNMBXMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ open class RNMBXMapView: UIView, RCTInvalidating {
get { _mapView?.mapboxMap }
}

// Provide public method to get mapbox from MapView
public func getMapboxMap() -> MapboxMap {
return self.mapView.mapboxMap
}

@objc public func addToMap(_ subview: UIView) {
withMapView { mapView in
// Check for RNMBXMapAndMapViewComponent first (requires MapView)
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@
"optional": true
}
},
"workspaces": [
"example"
],
"resolutions": {
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0"
Expand Down
Loading