7

React Native Draggable View

 1 year ago
source link: https://reactnativeexample.com/react-native-draggable-view/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Drag

React Native Draggable View

May 11, 2022 1 min read

React Native Draggable Reanimated

This package help you easy to drag any view


react-native-reanimated V2

demo.gif

Getting started

$ npm install react-native-draggable-reanimated --save

$ yarn add react-native-draggable-reanimated

  • All in one

$ npm install react-native-draggable-reanimated react-native-gesture-handler react-native-reanimated --save && cd ios && pod install

Usage

import DraggableView from 'react-native-draggable-reanimated';

<DraggableView
	initValue={{ x: 100, y: 100 }}
	onRelease={(val) => {
		console.log(val);
	}}>
	<View
		style={{
			backgroundColor: 'red',
			width: BOX_SIZE,
			height: BOX_SIZE,
		}}
	/>
</DraggableView>

License

This module is MIT licensed


GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK