1.0.2 • Published 6 years ago

react-native-pullie v1.0.2

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

react-native-pullie

(it's not slow, the gif has a low framerate)

🤔 What on earth is that?

This is a fully customizable pull-from-bottom <View />, useful for displaying extra information on the screen without having to worry too much about space.

📖 Installation

NOTE: REACT-NATIVE >= 0.59.0 REQUIRED. We're usingHooks()!

yarn add react-native-pullie

💡 Minimum usage Example

import React from 'react'
import { View, Text } from 'react-native'
import Pullie from 'react-native-pullie'

function MyView() {
  const [isOpen, setIsOpen] = React.useState(false)

  return (
    <React.Fragment>
      {/* my content... */}
      <Pullie
        isOpen={isOpen}
        setIsOpen={setIsOpen}
        teaser={
          <View style={{ height: 70 }}>
            <Text>Drag me</Text>
          </View>
        }
        teaserHeight={70}
      >
        <View>
          <Text>Hey there!</Text>
        </View>
      </Pullie>
    </React.Fragment>
  )
}

As you can see, it's a controlled component: it only opens if you want to and you close it programmatically (using context, for example).

🛠 Props

NameDescriptionTypeRequired (default)
isOpenIf the Pullie is openedbooleanYes
setIsOpenA callback fired when the view was openedfunction(bool)Yes
childrenThe contentReact.ReactNodeYes
teaserThe pullable contentReact.ReactNodeYes
teaserHeightThe height of the teasernumberNo (70)
screenHeightPercentageThe % of the screen that will be fillednumberNo (70)
backdropOpacityThe opacity of the backdrop when openednumberNo (70)
styleThe styles of the wrapper componentViewProps.styleNo

😳 Known issues / TODO

  • the backdrop suddenly disappears on click instead of fading out gracefully;
  • it's boring to specify a teaser height, maybe use the onLayout callback to measure it;
  • make an uncontrolled version.

👍 How to contribute

Have an idea? Found a bug? Please file an issue. Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.

✨ Credits

This library is basically react-native-bottom-drawer rewritten with the purpose of fitting my needs at toodo. Huge kudos to @rationalappdev.

📜 License

MIT