Coder Social home page Coder Social logo

Comments (6)

RCGitBot avatar RCGitBot commented on August 15, 2024

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

from purchases-ios.

NachoSoto avatar NachoSoto commented on August 15, 2024

Have you tried overriding .environment(\.dismiss, yourAction)?

from purchases-ios.

lionel-alves avatar lionel-alves commented on August 15, 2024

@NachoSoto Yes, here is what I tried:
1.

PaywallView(fonts: Font.Provider(), displayCloseButton: false)
.environment(\.dismiss, {})

Gives the error: Cannot convert value of type '() -> ()' to expected argument type 'DismissAction'
DismissAction doesn't have a public initializer

  1. Define my own DismissAction
struct DismissAction: EnvironmentKey {
    static var defaultValue: () -> Void = {}
}

extension EnvironmentValues {
    var dismiss: () -> Void {
        get { self[DismissAction.self] }
        set { self[DismissAction.self] = newValue }
    }
}

Used as follow:

PaywallView()
    .environment(\.dismiss, {

    })

That didn't work, the view was still dismissed. Note that this actually prevents the view from being dismissed if used on one of my views, but it doesn't work on RevenueCatUI views like PaywallView.

from purchases-ios.

lionel-alves avatar lionel-alves commented on August 15, 2024

Hi @NachoSoto, to fix this issue what do you think of passing a dismiss closure so that can be handle by the caller. The one presenting the view / vc should be the one responsible for dismissing it, right?
Since I cannot use it the onboarding, this issue prevents me from using the templates all together.
Thanks for the great work on this project!

from purchases-ios.

vegaro avatar vegaro commented on August 15, 2024

Hi @lionel-alves we just released a new view modifier onRequestedDismissal you can use to handle the dismissal

public func onRequestedDismissal(_ action: @escaping (() -> Void)) -> some View {

Please note if this is set, the paywall will not be dismissed automatically and it's your responsability to dismiss it.

I think this fixes this issue, so I am closing it. Let us know if you face any problems.

Thanks!

from purchases-ios.

github-actions avatar github-actions commented on August 15, 2024

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.

from purchases-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.