React Native Swipeable Panel

rn-swipeable-panel ise swipeable, easy to use bottom panel for your React Native projects. You can extend panel by swiping up, make it small or close by swiping down with pan gestures. Feel free to redesign inside of the panel.

npm version

⚙️ Installation

$ npm install rn-swipeable-panel --save

or

$ yarn add rn-swipeable-panel

🚀 How to use

import React from "react";
import { StyleSheet, Text, View } from "react-native";

import SwipeablePanel from "rn-swipeable-panel";

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      swipeablePanelActive: false,
    };
  }

  componentDidMount = () => {
    this.openPanel();
  };

  openPanel = () => {
    this.setState({ swipeablePanelActive: true });
  };

  closePanel = () => {
    this.setState({ swipeablePanelActive: false });
  };

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <SwipeablePanel
          fullWidth
          isActive={this.state.swipeablePanelActive}
          onClose={this.closePanel}
          onPressCloseButton={this.closePanel}
        >
          <PanelContent /> {/* Your Content Here */}
        </SwipeablePanel>
      </View>
    );
  }
}

☝️ Options

PropertiesTypeDescriptionDefault
isActiveboolShow/Hide the panelfalse
onCloseFunctionFired when the panel is closed
showCloseButtonboolSet true if you want to show close button
fullWidthboolSet true if you want to make full with panelfalse
openLargeboolSet true if you want to open panel large by defaultfalse
onlyLargeboolSet true if you want to let panel open just large modefalse
onlySmallboolSet true if you want to let panel open just small modefalse
noBackgroundOpacityboolSet true if you want to disable black background opacityfalse
styleObjectUse this prop to override panel style{}
closeRootStyleObjectUse this prop to override close button background style{}
closeIconStyleObjectUse this prop to override close button icon style{}
barStyleObjectUse this prop to override bar style{}
closeOnTouchOutsideboolSet true if you want to close panel by touching outsidefalse
noBarboolSet true if you want to remove gray barfalse

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

👏 Contributing

If you have any questions or requests or want to contribute to rn-swipeable-panel, please write the issue or give me a Pull Request freely.