JSPM

  • Created
  • Published
  • Downloads 36423
  • Score
    100M100P100Q168986F

A universal headless actionsheet component for React Native, Next.js & React

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@gluestack-ui/actionsheet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @gluestack-ui/actionsheet

    The Actionsheet component presents a set of options to the user, overlaid on top of the app's content, allowing them to take quick actions without leaving the current page or view.

    Installation

    To install the component, run the following command in your terminal. This will add the component to your project's dependencies and allow you to use it in your project.

    npx install @gluestack-ui/actionsheet

    Usage

    Default styling of all these components can be found in the components/core/actionsheet file. For reference, you can view the source code of the styled Actionsheet components.

    // import the styles
    import {
      Root,
      Content,
      Item,
      ItemText,
      DragIndicator,
      IndicatorWrapper,
      Backdrop,
    } from '../components/core/actionsheet/styled-components';
    
    // import the createActionsheet function
    import { createActionsheet } from '@gluestack-ui/actionsheet';
    
    // Understanding the API
    const Actionsheet = createActionsheet({
      Root,
      Content,
      Item,
      ItemText,
      DragIndicator,
      IndicatorWrapper,
      Backdrop,
    });
    
    // Using the actionsheet component
    export default () => (
      <Actionsheet isOpen={showActionsheet} onClose={handleClose}>
        <ActionsheetBackdrop />
        <ActionsheetContent>
          <ActionsheetDragIndicatorWrapper>
            <ActionsheetDragIndicator />
          </ActionsheetDragIndicatorWrapper>
          <ActionsheetItem onPress={handleClose}>
            <ActionsheetItemText>Community</ActionsheetItemText>
          </ActionsheetItem>
        </ActionsheetContent>
      </Actionsheet>
    );

    More guides on how to get started are available here.