Mapview Shows White Overlay on Interaction

Mapview shows White overlay on Interaction

Use instead

NavigationView {
MapView().edgesIgnoringSafeArea(.all)
.background(NavigationLink(destination: Text(""),
isActive: $abc) { EmptyView() })
}

SwiftUI / MapKit Annotation Selection and Navigation

Here is an idea (scratch)

  1. add a callback to representable
struct MapView: UIViewRepresentable {
var didSelect: (LandmarkAnnotation) -> () // callback

  1. so in ContentView
ZStack {
MapView() { annotation in
// store/pass annotation somewhere, and
// activate navigation link here, eg. via isActive or selection
}
}

  1. activate callback in delegate
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
if let v = view.annotation as? LandmarkAnnotation {
print(v.coordinate)

self.mapViewController.didSelect(v) // << here !!
}
}

MapFragment gets a dark overlay when used in DialogActivity

I got the same problem. After some research, I found two hacks :

  • Add this param for your theme in the styles.xml :

    <item name="android:backgroundDimEnabled">false</item>

Bad part : it removes the black overlays behind the activity.

  • Set the z order on the top for the map object :

    GoogleMapOptions googleMapsOptions = new GoogleMapOptions();

    googleMapsOptions.zOrderOnTop( true );

    MapFragment mapFragment = MapFragment.newInstance(googleMapsOptions);

Bad part : The map is above the Zoom control and MyLocation button.

Personnaly, I choose the first solution.

Hope this help !

Link to the source

Open sheet when a non-component is clicked, such as a Map Annotation

I don't really understand your example without more context, but maybe your should change the logic.
Why you just don't use an .onChange for viewModel.selectedItem, where selectedItem should be a @Published

.onChange(of: viewModel.selectedItem, perform: {
showActiveMapAnnotation = true
})

Pease give me more info about the view where you want the sheet to be displayed, and I can help you more.

Fragment layout seems to not be interactive/clickable

You don't put any code above so I assume your root view doesn't have click event, only the 3 buttons have.

Add clickable="true" to your white panel's root view to capture all the touch event



Related Topics



Leave a reply



Submit