import SwiftUI
import RevenueCat
import RevenueCatUI
struct BuyPremiumInfoOrButton: View {
@EnvironmentObject var store: Store
@State private var displayPaywall = false
var body: some View {
Group {
switch store.premiumState {
case .notLoaded:
Text("Loading...")
case .hasPremium:
Label("You have premium", systemImage: "crown")
case .doesNotHavePremium:
Button {
displayPaywall.toggle()
} label: {
Label("Upgrade to Premium", systemImage: "crown")
}
case .error:
Text("There was an error loading your premium status")
}
}.sheet(isPresented: self.$displayPaywall, onDismiss: {
store.refresh()
}) {
PaywallView()
}
}
}The above is my code. Its just using the PaywallView() from the RevenueCatUI. But this one seems to not dismiss the sheet that the paywall is in automatically after a purchase. So it seems like the PaywallView is not calling the environment dismiss after a purchase.
Does anybody know what the issue is?
My RevenueCat SDK version is 5.35.1
