1.1.4 • Published 11 months ago

react-native-dnd-like-ios v1.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

React Native Drag and Drop like IOS

npm downloads

"react-native-dnd-like-ios" is a powerful JavaScript library for creating captivating animations in your React Native applications. This library empowers developers to effortlessly incorporate smooth and fluid drag-and-drop interactions, inspired by the intuitive iOS user interface.

Intro

image

Installation

Install the library using npm or Yarn. Open your project's terminal and run one of the following commands:

npm install react-native-dnd-like-ios

or

yarn add react-native-dnd-like-ios

Setup

Add this line to the AndroidManifest.xml file for permissions.

<uses-permission android:name="android.permission.VIBRATE"/>

Quickstart

import React, { useState } from "react";
import { View, Text, Dimensions } from "react-native";
import DnDLikeIOS from "react-native-dnd-like-ios";
const { width, height } = Dimensions.get("window");

const users = [
  { name: "Name_No1" },
  { name: "Name_No2" },
  { name: "Name_No3" },
  { name: "Name_No4" },
  { name: "Name_No5" },
  { name: "Name_No6" },
  { name: "Name_No7" },
];

const _renderItem = (item, index) => {
  return (
    <View
      style={{
        backgroundColor: "rgba(0,0,0,0.4)",
        width: 75,
        height: 75,
        justifyContent: "center",
        alignItems: "center",
        borderRadius: 10,
      }}>
      <Text>{item?.name}</Text>
    </View>
  );
};

const App = () => {
  const [newData, setNewData] = useState([]);

  return (
    <View style={styles.container}>
      <DnDLikeIOS
        parentWidth={width}
        parentHeight={height}
        Item={_renderItem}
        data={users}
        setNewDataSource={setNewData}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#9CD7CB",
  },
});

Document

PropDefinedType
dataList the data used to render each list item.Array
setNewDataSourceReturn the new data when a handler deletes an item in the list.Function
ItemThis is the child component you want to show.Function
IconDeleteThis is the icon delete you want to show.Function
parentWidthThis is width of your component you want renderNumber
parentHeightThis is height of your component you want renderNumber
childrenWidthThis is width of your Child item component you want renderNumber
childrenHeightThis is height of your Child item component you want renderNumber
widthIconDeleteThis is width of icon deleteNumber
heightIconDeleteThis is height of icon deleteNumber
radiusIconDeleteThis is border radius of icon deleteNumber
topIconDeleteThis is position top of icon deleteNumber
leftIconDeleteThis is position left of icon deleteNumber
degLeftThis is the value to shake the Child item component to the leftString
degRightThis is the value to shake the Child item component to the rightString
timeoutShakeThis is the time at which the shaking stopsNumber
durationShakeLeftThis is the time to shake the Child item component to the leftNumber
valueShakeRightThis is the value to shake the Child item component to the rightNumber
durationShakeRightThis is the time to shake the Child item component to the rightNumber
marginChildrenBottomThis is the value to set the margin bottom of the Child item componentNumber
marginChildrenRightThis is the value to set the margin right of the Child item componentNumber
marginChildrenLeftThis is the value to set the margin left of the Child item componentNumber
marginChildrenTopThis is the value to set the margin top of the Child item componentNumber

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.0

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.1.1

11 months ago

1.0.0

11 months ago