Socket
Socket
Sign inDemoInstall

react-native-sliding-panels

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-sliding-panels

sliding panel for android and ios | react native


Version published
Weekly downloads
10
Maintainers
1
Install size
20.9 kB
Created
Weekly downloads
 

Readme

Source

React Native Sliding panel - Android and IOS

An Awesome fully Customizable library of react native for sliding panels purely implemented in Javascript. Works exceptionally well on android and ios.

This repo is Forked from the react-native-sliding-up-down-panels and add ability to slide from right or the left

Alt text

Features (What makes this library different)

Easily Assemble itself into your react native project
One library for both sliding up, down, right, left panel
Customizable Animatable and Draggable.
Extremely simple usage and implementation.
Provides maximum methods for dealing with every scenarios in sliding panels.
Constantly updating and improvizing to provide best experience to all the developers.

Installation

npm install react-native-sliding-panels --save

Copy and paste into the terminal in your project directory. For more information on npm install, please visit their official page

Minimal Example

Before start please note :
  1. Always Put flex: 1 on the root container component style in which you are using < SlidingPanel />.
  2. if u sliding either from right or top Always use prop headerLayoutHeight to mention the height of the sliding panel header, and for sliding from right or left Always use prop headerLayoutWidth to mention the width of the sliding panel header
import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Dimensions,
} from 'react-native';
const { width, height } = Dimensions.get('window');

import SlidingPanel from 'react-native-sliding-panels';


export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>                      
        
        <View style={styles.bodyViewStyle}>
          <Text>Hello My World</Text>
        </View>
        
        <SlidingPanel
            headerLayoutHeight = {100}
            headerLayout = { () =>
                <View style={styles.headerLayoutStyle}>
                  <Text style={styles.commonTextStyle}>My Awesome sliding panel</Text>
                </View>
            }
            slidingPanelLayout = { () =>
                <View style={styles.slidingPanelLayoutStyle}>
                  <Text style={styles.commonTextStyle}>The best thing about me is you</Text>
                </View>
            }
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  bodyViewStyle: {
    flex: 1,
    justifyContent: 'center', 
    alignItems: 'center',
  },
  headerLayoutStyle: {
    width, 
    height: 100, 
    backgroundColor: 'orange', 
    justifyContent: 'center', 
    alignItems: 'center',
  },
  slidingPanelLayoutStyle: {
    width, 
    height, 
    backgroundColor: '#7E52A0', 
    justifyContent: 'center', 
    alignItems: 'center',
  },
  commonTextStyle: {
    color: 'white', 
    fontSize: 18,
  },
});

If you are wrapping header layout inside a view, please make sure the height of that view is equal to headerLayoutHeight prop for sliding from up or bottom.

If you are wrapping header layout inside a view, please make sure the width of that view is equal to headerLayoutWidth prop for sliding from right or left.

Props

PropertyTypeDescriptionPlatform
headerLayoutHeightnumberHeader height of sliding panelandroid, ios
headerLayoutWidthnumberHeader width of sliding panelandroid, ios
headerLayoutfunctionHeader Layout of sliding panelandroid, ios
slidingPanelLayoutfunctionPanel Layout of sliding panelandroid, ios
AnimationSpeednumberAnimation speed, (in millisecond)android, ios
slidingPanelLayoutHeightnumberPanel height of sliding panelandroid, ios
slidingPanelLayoutWidthnumberPanel width of sliding panelandroid, ios
panelPositionstring"top" or "bottom" or "left" or "right"android, ios
visibleboooleanto show/hide sliding panelandroid, ios
allowDraggingboooleanallow sliding panel to dragandroid, ios
allowAnimationboooleanallow sliding panel to animateandroid, ios
onDragStartfunction(event, gestureState)returns event, gestureStateandroid, ios
onDragStopfunction(event, gestureState)returns event, gestureStateandroid, ios
onDragfunction(event, gestureState)returns event, gestureStateandroid, ios
onAnimationStartfunctiontriggers when panel animation startsandroid, ios
onAnimationStopfunctiontriggers when panel animation stopsandroid, ios

Methods

Method NameDescriptionPlatform
onRequestStartpanel animation starts, sliding panel opensandroid, ios
onRequestClosepanel animation stops, sliding panel stopsandroid, ios

Keywords

FAQs

Last updated on 03 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc