Automatic arrow direction
lucasfeijo opened this issue · comments
My current solution is to add this to the button from where you're launching the popover:
@State private var buttonRect: CGRect = .zero
var pickerDirection: MCPickerArrowDirection {
if buttonRect.minY < 300 {
return .up
} else {
return .down
}
}
Either use a Geometry Reader on the background of the button, or a helper method like I do:
.onRectChange {
buttonRect = $0
}
.emojiPicker(isPresented: $isShowingEmojiPicker,
selectedEmoji: $selectedEmoji,
arrowDirection: pickerDirection)