When delegate is not set, or if delegate does not close the menu if isOutside == true, hitTest calls itself infinitely, leading to stack overflow.
I assume the last line should be return super.hitTest(point, with: event)
From iOS/Menu.swift
open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard isOpened, isEnabled else {
return super.hitTest(point, with: event)
}
for v in subviews {
let p = v.convert(point, from: self)
if v.bounds.contains(p) {
delegate?.menu?(menu: self, tappedAt: point, isOutside: false)
return v.hitTest(p, with: event)
}
}
delegate?.menu?(menu: self, tappedAt: point, isOutside: true)
return self.hitTest(point, with: event)
}
I read you are working on a new Menu, FABMenu, so issue will possibly be moot by then.
I noticed this is a duplicate of a closed issue (sorry, I only looked at open issues) #672
However, the fix implemented in development branch is to call close(), perhaps this should be up to the managing app (at least if delegate is set)?
Hey, there is a fix for this already in the next major release. I am running through all the sample projects so that I could make the Material 2.5 release. The new menu is called FABMenu once released. I will leave this open until I release the next update.
Hey, this should be fixed in Material 2.5.0 using the latest FABMenu. All the best!
Will definately check it out. Thanks!
Most helpful comment
Hey, there is a fix for this already in the next major release. I am running through all the sample projects so that I could make the
Material 2.5release. The new menu is calledFABMenuonce released. I will leave this open until I release the next update.