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

PartialSheet Crash when using multiple horizontal scroll views #157

Open
jtressle opened this issue Jun 23, 2022 · 2 comments
Open

PartialSheet Crash when using multiple horizontal scroll views #157

jtressle opened this issue Jun 23, 2022 · 2 comments

Comments

@jtressle
Copy link

Hi,

I've constructed a partial sheet that basically has 3 rows of ScrollViews (horizontal). Each has 2 to 4 items, and the contents are static.

Both PartialSheet 2.0 and 3.0 failed intermittently when opening up this view. They fail at self.isPresented = isPresented in the function below:

public func updatePartialSheet<T>(isPresented: Bool? = nil, content: (() -> T)? = nil, onDismiss: (() -> Void)? = nil) where T: View { if let content = content { self.content = AnyView(content()) } if let onDismiss = onDismiss { self.onDismiss = onDismiss } if let isPresented = isPresented { withAnimation(defaultAnimation) { self.isPresented = isPresented } } }

The error messages I'm seeing for both 2.0 and 3.0 are:
[error] precondition failure: setting value during update: 94792
followed by:
AttributeGraph precondition failure: setting value during update: 94792.

I'm calling my view using partialSheet<Content: View>(isPresented: Binding<Bool>, @ViewBuilder content: @escaping () -> Content) to present my view.

I do not get the failure when I call partialSheetManager.showPartialSheet(content). However, partial sheet does not always present the entire view.

Is there anything I can try?

Thanks

@jtressle
Copy link
Author

I was able to solve this issue by placing everything in a vertical scrollview and then adding a fixed height constraint to the overall view.

So I think it was the complexity in calculating the view height that caused this crash.

Thanks,

@jtressle
Copy link
Author

One more update. I spoke too soon. The crash still occurs even when setting a fixed height to the view.

Thanks,

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