1.0.5 • Published 4 years ago

react-native-bottom-sheet-js v1.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

A bottom sheet that uses Material sheets #specs. Written in pure JS.

Installation

npm i react-native-bottom-sheet-js

or

yarn add react-native-bottom-sheet-js

if you are using Yarn

Usage

import BottomSheet from 'react-native-bottom-sheet-js'

// To open sheet do
this.bottomSheet.open()

// Always put <BottomSheet> at the very bottom of the screen file
<View>
  {/* Other content here. */}
  <BottomSheet
    ref={bottomSheet => { this.bottomSheet = bottomSheet }}
  >
    <Text>This is the content that will display when the bottom sheet is open.</Text>
  </BottomSheet>
</View>

Props

  • backgroundColor

    • String

      Color of the background

  • minHeight

  • maxHeight

    • Number

      Maximum height of the sheet when open(only triggers when you have a lot of content). default value is 50%(Dimensions.get('window).height) of the screen height. as stated https://material.io/components/sheets-bottom/#specs the maximum height of a sheet must be half of the screen size which is 50%.

  • contentStyle

    • Object

      Style of the content component. Only accepts object as a parameter. If you specify a height on this component be sure to have it <= maxHeight so it won't clamp and render stuff out of place. You can add paddings or margins here.

Methods

  • open()

    • Opens the bottom sheet.
  • close()

    • Closes the sheet.
  • toggle()

    • Open or closes the sheet based on last state.

Contribute

Open for PR's. Any improvements or fixes are welcome!

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago