PopupView
PopupView copied to clipboard
dismissCallback() not call
I used the library and noticed that the dismiss Callback was not called after the popup was hidden
Hey @hoangnam714, hidden in what way? Could you please provide minimal reproducible example? Have a nice day
here is the code i used, thank you very much
.popup(isPresented: $showDetail, type: .`default`, position: .bottom, dragToDismiss: true, closeOnTap: false, backgroundColor: .black.opacity(0.4),dismissCallback: {
self.tabbarStore.isHident = false
TabBarModifier.showTabBar()
}) {
AchievementDetailView(data: achievementData.achievements[indexAchivement], ontapDissmiss: {
self.showDetail = false
})
}
@hoangnam714 I can not launch your code exactly, here is the closest I could do - dismissCallback is called as expected
.popup(isPresented: $floats.showingTopFirst, type: .`default`, position: .bottom, dragToDismiss: true, closeOnTap: false, backgroundColor: .black.opacity(0.4), dismissCallback: {
print("Hello")
}) {
Color.red
}
@f3dm76 I understood why the callback function didn't work, because I didn't use the default diss miss, instead I changed the value of the state outside the code block.

I am not sure if dismiss block should be called in this case... I'll think about it. Have a nice day!
Thank you, I will think more about this, because sometimes we don't close the popup as soon as the user touches it, instead it needs a close button for example. :)
Hey @hoangnam714, I gave it more thought and since .sheet does it, I also added this. I also added dismiss source as a parameter in dismiss callback, so you can distinguish if you need this.This feature is implemented in version 1.2.0, please give it a go. Have a marvellous day!