Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Fatal error: No ObservableObject of type ResponderChain found. A View.environmentObject(_:) for ResponderChain may be missing as an ancestor of this view." #5

Closed
Amzd opened this issue Jan 21, 2021 · 0 comments

Comments

@Amzd
Copy link
Owner

Amzd commented Jan 21, 2021

This happens when you don't forward the EnvironmentObject.

If you have a sheet or a ViewRepresentable layer you have to manually forward the ResponderChain.

.sheet(isPresented: $showSheetView) {
    ExampleModal().environmentObject(chain)
}

More detailed explanation of why you have to do this:
https://medium.com/swlh/swiftui-and-the-missing-environment-object-1a4bf8913ba7

Long story short, it seems that when we present a new View or Action Sheet that entity is no longer considered to be in the current view hierarchy.


Note: If you have issues with the modal being initialized when the ResponderChain changes then switch to .withResponderChainForCurrentWindow()

@Amzd Amzd closed this as completed Jan 21, 2021
@Amzd Amzd pinned this issue Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant