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

Add Modal Feature #26

Closed
gorhom opened this issue Sep 3, 2020 · 3 comments · Fixed by #37
Closed

Add Modal Feature #26

gorhom opened this issue Sep 3, 2020 · 3 comments · Fixed by #37
Assignees
Labels
enhancement New feature or request

Comments

@gorhom
Copy link
Owner

gorhom commented Sep 3, 2020

Feature Request

Why it is needed

This will the library to behave like a Modal View.

Possible implementation

We could introduce:

  • BottomSheetContainerProvider: this will be responsible of:

    • holding the BottomSheet view.
    • mounting & unmount the BottomSheet when user trigger the modal.
    • exposing a new context for modal use.
  • useBottomSheetModal: this will expose:

    • present a method that will mount the bottom sheet with initial close position, then snap to a provided snap point.
    • dismiss a method that will close the bottom sheet then unmount it.
    • snapTo a method to snap to a certain point.

Code sample

BottomSheetContainerProvider

# to be add at the root
<BottomSheetContainerProvider>
  <App />
</BottomSheetContainerProvider>

# 
const { present } = useBottomSheetModal()

...

const handlePresetView = () => {
  present({
    snapPoints: [100, '50%', '90%'],
    children: /** BOTTOM SHEET CONTENT */
  })
}

useBottomSheetModal

interface BottomSheetModalContext {
  present: (configs: BottomSheetProps) => void
  dismiss: () => void
  snapTo: (index: number) => void
}
@gorhom gorhom added the enhancement New feature or request label Sep 3, 2020
@gorhom
Copy link
Owner Author

gorhom commented Sep 3, 2020

@sa8ab would you be interested 😉

@NishidaRyu416
Copy link

NishidaRyu416 commented Sep 16, 2020

Surely, I am! I mean I gave up using an alternative module of this because it couldn’t be used from a child component to show contents over an existing content just like modal.

@gorhom gorhom self-assigned this Sep 24, 2020
@gorhom
Copy link
Owner Author

gorhom commented Sep 24, 2020

@NishidaRyu416 im on it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants