Code Monkey home page Code Monkey logo

rn-swipeable-panel's Introduction

React Native Swipeable Panel

rn-swipeable-panel is a 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

To install the package;

$ yarn add rn-swipeable-panel

โœ… It is done!

๐Ÿš€ How to use

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

import { SwipeablePanel } from 'rn-swipeable-panel';

export default App = () => {
  const [panelProps, setPanelProps] = useState({
    fullWidth: true,
    openLarge: true,
    showCloseButton: true,
    onClose: () => closePanel(),
    onPressCloseButton: () => closePanel(),
    // ...or any prop you want
  });
  const [isPanelActive, setIsPanelActive] = useState(false);

  const openPanel = () => {
    setIsPanelActive(true);
  };

  const closePanel = () => {
    setIsPanelActive(false);
  };

  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 {...panelProps} isActive={isPanelActive}>
        <PanelContent /> {/* Your Content Here */}
      </SwipeablePanel>
    </View>
  );
};

โ˜๏ธ Options


Properties Type Description Default
isActive bool Show/Hide the panel false
onClose Function Fired when the panel is closed
showCloseButton bool Set true if you want to show close button
fullWidth bool Set true if you want to make full with panel false
openLarge bool Set true if you want to open panel large by default false
onlyLarge bool Set true if you want to let panel open just large mode false
onlySmall bool Set true if you want to let panel open just small mode false
noBackgroundOpacity bool Set true if you want to disable black background opacity false
style Object Use this prop to override panel style {}
closeRootStyle Object Use this prop to override close button background style {}
closeIconStyle Object Use this prop to override close button icon style {}
barStyle Object Use this prop to override bar style {}
smallPanelHeight Object Use this prop to override the small panel default height
barContainerStyle Object Use this prop to override bar container style {}
closeOnTouchOutside bool Set true if you want to close panel by touching outside false
allowTouchOutside bool Set true if you want to make toucable outside of panel false
noBar bool Set true if you want to remove gray bar false
scrollViewProps Object Use this prop to override scroll view that inside the panel {}

โญ๏ธ 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.