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

dragIndicator animation bug. #101

Closed
dortus47 opened this issue Sep 20, 2022 · 8 comments
Closed

dragIndicator animation bug. #101

dortus47 opened this issue Sep 20, 2022 · 8 comments
Labels
bug Something isn't working Thank You ❤️ For people who appreciate my work

Comments

@dortus47
Copy link

Describe the bug

스크린샷 2022-09-20 오후 5 14 26

Hello, I am developing the swiftui app using the bottom sheet library. Thank you for creating a good library.

While using the library, I experienced the same phenomenon as in the video below, but when I drag the bottom sheet, the animation of the dragIndicator is applied strangely and I can't find the right location.
Can I remove the application of these animations?

Minimal reproduce-able code

                    .bottomSheet(bottomSheetPosition: $bottomSheetPosition, switchablePositions: [
                        .relative(0.4),
                        .relativeTop(0.9)
                    ]) {
                        listView
                    }

Expected behavior
The bottom sheet contains a scroll view. This is happening when you drag this bottom sheet up and down.

Screenshots
If applicable, add screenshots to help explain your problem.

123.mov

Target version
iOS:: 16.0
BottomSheet:: 3.0.2

@lucaszischka lucaszischka added bug Something isn't working Thank You ❤️ For people who appreciate my work labels Sep 20, 2022
@lucaszischka
Copy link
Owner

I can not reproduce this bug with the provided information and code. But maybe have a look at the .customAnimation(Animation?)modifier.

@lucaszischka lucaszischka closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
@dortus47
Copy link
Author

dortus47 commented Sep 21, 2022

@lucaszischka

123321.mov

I'm sorry for the lack of examples in yesterday's post. I found the same phenomenon while looking at Word Search View among the examples posted on GitHub to reproduce it.
Depending on the strength of dragging up and down, the drag indicator fluctuates heavily and is out of the specified range.
If you don't mind, can I ask you to check it again?
Thank you.

device:: iPhone 11 Pro
OS:: iOS 16.0
BottomSheet:: 3.0.2

When you drag the bottom sheet after touching the scroll view inside the bottom sheet, the animation of the drag indicator seems to be weird.

struct ContentView: View {
    
    @State var bottomSheetPosition: BottomSheetPosition = .relative(0.4)
    @State var searchText: String = ""
    
    let backgroundColors: [Color] = [Color(red: 0.28, green: 0.28, blue: 0.53), Color(red: 1, green: 0.69, blue: 0.26)]
    let words: [String] = ["birthday", "pancake", "expansion", "brick", "bushes", "coal", "calendar", "home", "pig", "bath", "reading", "cellar", "knot", "year", "ink"]
    
    var filteredWords: [String] {
        self.words.filter({ $0.contains(self.searchText.lowercased()) || self.searchText.isEmpty })
    }
    
    
    var body: some View {
        //A green gradient as a background that ignores the safe area.
        LinearGradient(gradient: Gradient(colors: self.backgroundColors), startPoint: .topLeading, endPoint: .bottomTrailing)
            .edgesIgnoringSafeArea(.all)
        
            .bottomSheet(bottomSheetPosition: self.$bottomSheetPosition, switchablePositions: [
                .relativeBottom(0.125),
                .relative(0.4),
                .relativeTop(0.975)
            ], headerContent: {
                //A SearchBar as headerContent.
                HStack {
                    Image(systemName: "magnifyingglass")
                    TextField("Search", text: self.$searchText)
                }
                .foregroundColor(Color(UIColor.secondaryLabel))
                .padding(.vertical, 8)
                .padding(.horizontal, 5)
                .background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.quaternaryLabel)))
                .padding([.horizontal, .bottom])
                //When you tap the SearchBar, the BottomSheet moves to the .top position to make room for the keyboard.
                .onTapGesture {
                    self.bottomSheetPosition = .relativeTop(0.975)
                }
            }) {
                //The list of nouns that will be filtered by the searchText.
                ForEach(self.filteredWords, id: \.self) { word in
                    Text(word)
                        .font(.title)
                        .padding([.leading, .bottom])
                        .frame(maxWidth: .infinity, alignment: .leading)
                }
                .frame(maxWidth: .infinity, alignment: .leading)
                .transition(.opacity)
                .animation(.easeInOut, value: self.filteredWords)
                .padding(.top)
            }
            .enableAppleScrollBehavior()
            .enableBackgroundBlur()
            .backgroundBlurMaterial(.systemDark)
    }
}

@lucaszischka lucaszischka reopened this Sep 21, 2022
@lucaszischka
Copy link
Owner

I will have another look next week.

@bgeisb
Copy link

bgeisb commented Nov 14, 2022

I'm facing the same issue, unfortunately.

Device: iPhone 14 Pro (Simulator)
OS: iOS 16.1
BottomSheet: 3.1.0

Is there any progress so far, @lucaszischka?

@mchen-msrl
Copy link

Facing same issue on iOS 16

Device: iPhone 12
OS: iOS 16.1
BottomSheet: 3.1.0

@lucaszischka
Copy link
Owner

No I’m currently very busy currently. I don’t think there will be progress soon (as of me). However feel free to fix it yourself and make a pull request. Sorry.

@Urkman
Copy link

Urkman commented Jan 29, 2023

Iw there a solution for this or a hint for another lib?

@lucaszischka
Copy link
Owner

lucaszischka commented Jan 30, 2023

Maybe try adding .animation(nil) somewhere in the view hierarchy (as 'low'/'near' as possible by the dragIndicator view).

grandsir added a commit to grandsir/BottomSheet that referenced this issue Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Thank You ❤️ For people who appreciate my work
Projects
None yet
Development

No branches or pull requests

5 participants