Coder Social home page Coder Social logo

yaraht17 / react-native-draggable-view Goto Github PK

View Code? Open in Web Editor NEW
116.0 5.0 35.0 615 KB

DraggableView is a component for react-native, it allows you have a vertical draggable drawer view that you can drag up or drag down. So, if you drag and release that component, then it keeps moving until reach either initial position or container border.

License: MIT License

JavaScript 81.24% Python 4.34% Java 3.32% Objective-C 11.10%
drag-and-drop drawer draggableview react-native bottom-drawer bottomsheet

react-native-draggable-view's Introduction

react-native-draggable-view

DraggableView is a component for react-native, it allows you have a vertical draggable view that you can drag up or drag down. So, if you drag and release that component, then it keeps moving until reach either initial position or container border.

Example

react-native-draggable-view

Installation

$ npm i react-native-draggable-view --save

Usage

    <Drawer
        initialDrawerSize={0.09}
        autoDrawerUp={1} // 1 to auto up, 0 to auto down
        renderContainerView={() => (
            <Screen2 navigation={this.props.navigation} />
        )}
        renderDrawerView={() => (
            <Screen3 navigation={this.props.navigation} />
        )}
        renderInitDrawerView={() => (
            <View style={{ backgroundColor: 'white', height: 66 }}>
                <StatusBar hidden={true} />
                <CartHeader />
            </View>
        )}
    />

Properties

Prop Default Type Description
onDragDown undefined function If you pass a function as parameter it will be notified when the user drag down the drawer
onRelease undefined function If you pass a function as parameter it will be notified when the user release the drawer after drag it
initialDrawerSize 0.0 number It's the initial position or size for Drawer component. If drawer size is 1 that means its using 100% of avalaible space on the screen
isInverseDirection false boolean Allows to use the draggable view in the inverse direction. Which means from the top to the bottom. By default is from the bottom to the top.
renderContainerView undefined View Pass as parameter a renderable react component to show as container.
renderDrawerView undefined View Pass as parameter a renderable react component to show as drawer.
renderInitDrawerView undefined View Pass as parameter a renderable react component to show as view can draggable
finalDrawerHeight 0 number The height position that the drawer will stop starting from top. Example: finalDrawerHeight={100} will stop the drawer at 100 pixels from reaching the top.

react-native-draggable-view's People

Contributors

dependabot[bot] avatar div-leo avatar johhansantana avatar mateoguzmana avatar nelsonchen5 avatar yaraht17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-draggable-view's Issues

Add option to have an inverse draggable view.

The current solution only works in one direction, which is not very helpful. However, it can be more dynamic.

It should allow sending a prop to the component to know if you want to have the drawer in inverse mode. (By default is will be from the bottom to the top)

Example of current draggable view:
68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f424131756352504b4d4e4d39712f67697068792e676966

Inverse mode:
inversemode

Usage with React Native Maps

How to use with react native maps. In my scenario, the drawer view is a MapView and scrolling the map results in dragging the view down. I am using 0.63.3

Not able to run Example

When I tried the Drawer, it gives below error on device.
What could be the reason?

Initializing <RCTCxxBridge: 0x6000001a71c0> (parent: <RCTBridge: 0x6080000a37e0>, executor: RCTWebSocketExecutor)
2017-08-24 01:44:21.955 [fatal][tid:main] Unable to resolve module ReactNativeART from <user DIR path>/Example/DemoDrawer/node_modules/react-native/Libraries/react-native/react-native-implementation.js: Module does not exist in the module map

Not working with iPhone-X

I have integrated the lib, its not show the the drawer with iPhone-X
lib Info:
Node: 10.15.0 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
react: 16.8.3 => 16.8.3
react-native: 0.59.8 => 0.59.8
react-native-cli: 2.0.1
react-native-rename: 2.4.1

import Drawrer throwing an error

As I try to import Drawer from 'react-native-draggable-view' I got this error: undefined is not a function (near '..._react2.default.createClass...').
I installed react-native-draggable-view with npm i react-native-draggable-view --save and my package.json shows the version 0.0.4

Am I doing something wrong? Do you know which might be the problem?

Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`

Good day,

I have implemented your react-native-draggable-view into my project, and have gotten it to work, but every time I slide the drawer up or down, I receive the above error. I am using version 0.0.6 and have went into the source code and cannot find a remedy. Here is the code I wrote to trigger the error:

import React, { useState, useEffect, Component }from "react";
import {Alert, Dimensions, Platform, StyleSheet, Text, View, Button, TouchableOpacity, TouchableHighlight, SafeAreaView, ScrollView, ActivityIndicator, StatusBar} from "react-native";
import Drawer from 'react-native-draggable-view' 
import {Screen2} from './Screen2'
import {Screen3} from './Screen3'

function Screen({navigation}) {

return(
      <View style = {styles.container}>
          <Drawer
        initialDrawerSize={0.3}
        finalDrawerHeight={0.5}

        //autoDrawerUp={0.5}
        renderContainerView={() => (
          <Screen2 navigation = {navigation}/>
        )}
        renderDrawerView={() => (
          <Screen3 navigation = {navigation} />
        )}
          renderInitDrawerView={() => (
            <View style = {{alignItems: 'center'}}>
            <View style={{backgroundColor: '#d3d3d3', height: height*0.01, width: width*0.2, alignItems: 'center'}}>
            <StatusBar hidden={false} />
            </View>
            </View>
      )}
    />
      </View>

)
}

export {Screen}

Add react-native-draggable-view to reactnative.gallery ๐ŸŽจ

Hi @yaraht17!

Sorry, this is not an issue...

I'm Xavier and Iโ€™ve been working as a freelance React Native developer for more than 2 years.
I try to help community when I can: sharing my works on open-source, like you do!

I want to help developers to have more visibility.
So, I've created a website where developers can share with entire
world their React Native projects, components, apps...

This website allow developers to show their works and get feedback.
Just like a Dribbble but for React Native developers.

https://reactnative.gallery

Or chat about it?
https://slack.reactnative.gallery

Unable to resolve module

This component doesn't work. It tries to look for a component Screen2 in node_modules/components/ and fails with the error Unable to resolve module since I don't have that component

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.