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)
- add a callback to representable
struct MapView: UIViewRepresentable {
var didSelect: (LandmarkAnnotation) -> () // callback
- so in
ContentView
ZStack {
MapView() { annotation in
// store/pass annotation somewhere, and
// activate navigation link here, eg. via isActive or selection
}
}
- 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
Getting Reference to a Dictionary Value
How to Reconstruct Grayscale Image from Intensity Values
Swift How to Make List Start at The Top with No Padding
Swiftui Wrapping Hstack with Images
Do Not Copy Swift Libraries with Xcode 8
Swiftui Go Back Programmatically from Representable to View
Extension for Average to Return Double from Numeric Generic
Trouble Calling a Method in an Init
Sharing Button Works Perfectly on iPhone But Crash on Ipad
Problem with Frameworks in Command Line Tool
How to Create Generic Closures in Swift
Optional Protocol Requirements, I Can't Get It to Work
Can't Dismiss View Controller That's Embedded in a Navigation Controller
Public Default Init in Protocol
Realm Write Transaction Failing, Despite Being in Transaction
Uitableview Didselectrow Returns Wrong Row Index Value
Testing a Class Which Preserves Its State in Private Variables