Socket
Book a DemoInstallSign in
Socket

@codebet/react-native-draggable

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codebet/react-native-draggable

draggable

latest
Source
npmnpm
Version
1.0.15
Version published
Maintainers
4
Created
Source

react-native-draggable

Draggable item for react-native!

How to use

return (
    <View >
        <Draggable renderSize={56} renderColor='black' offsetX={-100} offsetY={-200} pressDrag={()=>alert('touched!!')} tolerance={5} />
            <ChildCompoent />
        <Draggable/>
    </View>
);

Demo

N|Solid in my project =>

return (
    <View style={{backgroundColor: 'blue', flex: 0.5}} >
        <Draggable renderShape='image' imageSource={this.state.source} renderSize={80}
            offsetX={0} offsetY={0}
            pressDragRelease={this._changeFace}
            longPressDrag={()=>console.log('long press')}
            pressDrag={()=>console.log('press drag')}
            pressInDrag={()=>console.log('in press')}
            pressOutDrag={()=>console.log('out press')}
        />
    </View>
);

Event Demo

DEMO2

Props spec & Example

Properties

PropTypeExampleDefaultDescription
tolerancenumber{25}{0}Distance component can move and also trigger click
offsetXnumber{0}{100}offsetX with center
offsetYnumber{100}{100}offsetY with center
xnumber{0}---position x
ynumber{0}---position y
znumber{0}---position z
reversebool{true}{true}reverse flag

Events

EventTypeDescription
pressDragfunconPress event
pressDragReleasefuncrelease drag event
longPressDragfunclong press event
pressInDragfuncin press event
pressOutDragfuncout press event

Methods

MethodparamsDescription
reversePosition---manually reset Draggable to start position

What's next?

This Draggable is used to be a Draggable Button in my project. Let me know if you have any idea or demand, let's discuss and develop it.    

Keywords

react-native

FAQs

Package last updated on 21 Jan 2019

Did you know?

Socket

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