Git Product home page Git Product logo

bottomsheet's Introduction

bottomsheet's People

Contributors

anuragajwani avatar wouter125 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bottomsheet's Issues

To do for stable release

  • Safely unwrap the actual position after dragging. Can be nil which causes a hard crash
  • When state changes make the UI reflect those changes by using updateUIViewController
  • Move modulate function into the ondrag modifier so value is always between 0 and 1 instead of the raw numbers.
  • Find vertical scrollview based on tag to prevent crashes on multiple nested scrollviews.
  • Include manual disable and enable drag functionality.
  • Add the ability to exclude values from the snapping enum
  • Improve position callbacks to better handle certain scroll cases.

Cannot find 'BottomSheetView' in scope

Xcode version: 15.0.1
BottomSheet version: 2.0.1

I added an import for BottomSheet in a SwiftUI View file. When I call BottomSheetView just like an example in the README.md:

BottomSheetView(
    position: $position,
    animationCurve: SheetAnimation(
        mass: 1,
        stiffness: 250,
        damping: 25
    ),
    background: (
        Color(UIColor.secondarySystemBackground)
    ),
    header: { },
    content: {
        EmptyView()
            .onSheetDrag(translation: $settings.translation)
    }
}

I get an compiler error: Cannot find 'BottomSheetView' in scope

Scroll view moves to the top after position changing

Hey. Thanx for such awesome lib)

To reproduce:
In sample app drag sheet to top position, the drag content even higher. Then drag header to any other position without touching content. After that try to drag content.

Misisng License file in the repository

swift-package-list and other automatic license generation tool expect a LICENSE file being present in order to introduce it in the generated settings bundle. As such a License file is required in the repo.

I have created a PR for it:
#34

V2

Hi, I'm playing around with the new version and it's quite nice !

I'm currently having 2 issues :

• first I think the Spacer() at the top of SheetPlus.body is useless and It actually cause an issue when using full height and trying to touch the NavigationBar with the sheet. Removing it fixed the issue. If it's intended to be there maybe this should be configurable ?

• second I couldn't find the correct way to add a NavigationView as the body of the sheet. If I add a NavigationView it break some constraints. I figured I could set ideal frame to the NavigationView and it shows but then the scrolling behaviour is no longer working inside the scrolling content. Depending if I add a scrollview to the content inside the NavigationView, I either have the navbar working or the scroll.

I'm not sure how to fix the second issue, iterating child views to find a scrollview and adding your scroll behaviour and if no scrollview if found adding one like you do might work but it might be hard to be sure to stop on the right scrollview. I believe the Apple version use something like that but don't look too deep in the childviews.

I'll make a fork to display the issue.

License

Hi, what is the license for this library?

Incorrect starting position and weird animation inside NavigationView

I am using relative positioning inside a NavigationView. The issue about the wrong position and enter animation makes this library unusable. If there is no NavigationView, there is no issue. But I do need it.

enum BottomSheetPosition: CGFloat, CaseIterable {
    case top = 0.83
    case middle = 0.385
}

@State var bottomSheetPosition: BottomSheetPosition = .middle

BottomSheetView(
                position: $bottomSheetPosition,
                header: {
                },
                content: {
                    ForecastView(bottomSheetTranslationProrated: bottomSheetTranslationProrated)
                    
                }
            )
            .onBottomSheetDrag { translation in
                bottomSheetTranslation = translation

                withAnimation(.easeInOut) {
                    if bottomSheetPosition == BottomSheetPosition.top {
                        hasDragged = true
                    } else {
                        hasDragged = false
                    }
                }
            }
Screen.Recording.2022-05-24.at.10.20.37.mov

V2 Roadmap

I will try to keep a list of fixes that need to be applied here. Feel free to open a PR if you got a fix for some of them;

Minor

  • Release fix that solves presenting items from detached view controller
  • Release fix where interaction enabled upTo get's lost after navigating

Major

  • Write documentation of how you can attach the sheet on a navigationView stack.
  • Figure out how to handle nested scrollviews (adds support for Lists / NavigationViews)

Released

  • Resolve bug when content is non-scrollable and UI snaps back to original start position.
  • Rename some of the additional properties towards Apple's API.
  • Include some properties such as; dragHandle / scrim / content scaling
  • Programmatically setting the sheet to a different height is currently broken. -> Due to UIViewRepresentable not passing through my values.
  • Replace keyboard hack with something more solid. Now the selected detents break after calling it twice.
  • Double check if the additional spacer is still needed (potential fix might be calculating the offset from the bottom of the screen by using .offset(y: UIScreen.main.bounds.height - translation))
  • Prevent the preference key reset when keyboard opens up (early return when there are no detents, prevents this issue for now)
  • Set default height when there is no selectedDetent configured
  • Make the header property optional inside the configuration
  • Add out animation when dismissing the sheet.

Click to dissmiss

I think that adding in a feature where you can dismiss the view by clicking the background would be beneficial.

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.