├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .npmignore ├── App.tsx ├── README.md ├── __tests__ └── App-test.js ├── android ├── .gradle │ ├── 4.10.2 │ │ ├── fileChanges │ │ │ └── last-build.bin │ │ ├── fileContent │ │ │ └── fileContent.lock │ │ ├── fileHashes │ │ │ ├── fileHashes.bin │ │ │ ├── fileHashes.lock │ │ │ └── resourceHashesCache.bin │ │ ├── gc.properties │ │ ├── javaCompile │ │ │ ├── classAnalysis.bin │ │ │ ├── jarAnalysis.bin │ │ │ ├── javaCompile.lock │ │ │ └── taskHistory.bin │ │ └── taskHistory │ │ │ ├── taskHistory.bin │ │ │ └── taskHistory.lock │ ├── buildOutputCleanup │ │ ├── buildOutputCleanup.lock │ │ ├── cache.properties │ │ └── outputFiles.bin │ └── vcs-1 │ │ └── gc.properties ├── app │ ├── BUCK │ ├── build.gradle │ ├── build_defs.bzl │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── dragdroplibrary │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ └── debug.keystore.properties └── settings.gradle ├── app.json ├── assets ├── close_white.png ├── close_white@2x.png ├── close_white@3x.png ├── icon.png └── splash.png ├── babel.config.js ├── demo.gif ├── drag-drop-lib ├── .babelrc ├── Tile.tsx ├── built │ ├── Tile.js │ ├── Tile.js.map │ ├── dragDropGrid.js │ ├── dragDropGrid.js.map │ ├── index.js │ ├── index.js.map │ ├── webpack.config.js │ └── webpack.config.js.map ├── dragDropGrid.tsx ├── index.ts ├── package-lock.json ├── package.json ├── tsconfig.json ├── webpack.config.js ├── yarn-error.log └── yarn.lock ├── index.js ├── ios ├── DragDropLibrary-tvOS │ └── Info.plist ├── DragDropLibrary-tvOSTests │ └── Info.plist ├── DragDropLibrary.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcuserdata │ │ │ └── mitel.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── DragDropLibrary-tvOS.xcscheme │ │ │ └── DragDropLibrary.xcscheme │ └── xcuserdata │ │ └── mitel.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── DragDropLibrary │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ └── main.m └── DragDropLibraryTests │ ├── DragDropLibraryTests.m │ └── Info.plist ├── metro.config.js ├── package-lock.json ├── package.json ├── rn-cli.config.js ├── styles.tsx ├── tsconfig.json └── yarn.lock /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | 28 | [options] 29 | emoji=true 30 | 31 | esproposal.optional_chaining=enable 32 | esproposal.nullish_coalescing=enable 33 | 34 | module.system=haste 35 | module.system.haste.use_name_reducers=true 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .ios suffix 41 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 44 | module.system.haste.paths.blacklist=.*/__tests__/.* 45 | module.system.haste.paths.blacklist=.*/__mocks__/.* 46 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 47 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 52 | 53 | module.file_ext=.js 54 | module.file_ext=.jsx 55 | module.file_ext=.json 56 | module.file_ext=.native.js 57 | 58 | suppress_type=$FlowIssue 59 | suppress_type=$FlowFixMe 60 | suppress_type=$FlowFixMeProps 61 | suppress_type=$FlowFixMeState 62 | 63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 67 | 68 | [version] 69 | ^0.92.0 70 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .idea 3 | node_modules 4 | demo 5 | .watchmanconfig 6 | build 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | demo 4 | .watchmanconfig 5 | example.gif 6 | -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | * @flow 7 | */ 8 | 9 | import React, { Component } from 'react' 10 | import { 11 | StyleSheet, 12 | Text, 13 | View, 14 | Image, 15 | TouchableOpacity 16 | } from 'react-native' 17 | 18 | import {DragDropGrid }from "react-native-drag-drop-grid-library" 19 | import { Style } from './styles'; 20 | export default class App extends Component { 21 | alphabets:Array 22 | sortGrid:any; 23 | constructor(props: any) { 24 | super(props); 25 | this.alphabets = ['1','2','3','4','5','6', 26 | '7','8','9','10','11','12', 27 | '13','14','15','16','17','18', 28 | '19','20','21','22','23','24']; 29 | this.onRemove = this.onRemove.bind(this); 30 | } 31 | 32 | onRemove(letter){ 33 | this.sortGrid.deleteBlockList(letter); 34 | } 35 | getColor() { 36 | let r = this.randomRGB() 37 | let g = this.randomRGB() 38 | let b = this.randomRGB() 39 | return 'rgb(' + r + ', ' + g + ', ' + b + ')' 40 | }; 41 | 42 | 43 | randomRGB = () => 160 + Math.random()*85 44 | 45 | render() { 46 | return ( 47 | 48 | { 50 | this.sortGrid = sortGrid; 51 | }} 52 | blockTransitionDuration={400} 53 | activeBlockCenteringDuration={200} 54 | itemsPerRow={4} 55 | dragActivationTreshold={200} 56 | onDragRelease = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ", itemOrder) } 57 | onDragStart = { (key) => console.log("Some block is being dragged now!",key) } 58 | onMerge = {(itemKey,mergeBlockKey) => console.log("item and merge item",itemKey,mergeBlockKey)} 59 | merge={true} 60 | onDeleteItem = { (item) => console.log("Item was deleted:", item) }> 61 | { 62 | this.alphabets.map( (letter, index) => 63 | 65 | {letter} 67 | 68 | this.onRemove(letter)}> 71 | 78 | 79 | 80 | 81 | 82 | 83 | ) 84 | } 85 | 86 | 87 | ) 88 | } 89 | 90 | } 91 | 92 | const styles = StyleSheet.create({ 93 | block: { 94 | flex: 1, 95 | margin: 8, 96 | borderRadius: 50, 97 | justifyContent: 'center', 98 | alignItems: 'center' 99 | }, 100 | circle: { 101 | borderRadius: 100 / 2, 102 | alignItems: 'center', 103 | justifyContent: 'center' 104 | }, 105 | close: { 106 | position: 'absolute', 107 | right: 0, 108 | top: 0 109 | } 110 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DragDropLibrary 2 | A Sample React Native Library for Draggable Sortable Grid , Performs operations like 3 | 4 | - re-ordering grid items, 5 | - deleting animation grid items 6 | - merge animation for grid items 7 | 8 | 9 |

10 | Issue Stats 11 |

12 | 13 | 14 | ## Library Installation 15 | 16 | > npm i react-native-drag-drop-grid-library --save 17 | 18 | ## Sample Implementation 19 | Suppose alphabets is an array of objects 20 | 21 | ```javascript 22 | 23 | this.alphabets = ['1','2','3','4','5','6', 24 | '7','8','9','10','11','12', 25 | '13','14','15','16','17','18', 26 | '19','20','21','22','23','24']; 27 | ``` 28 | 29 | # Features: 30 | - Sortable(Draggable) Grid feature: 31 | ```javascript 32 | render(){ 33 | 34 | { 36 | this.sortGrid = sortGrid; 37 | }} 38 | blockTransitionDuration={400} 39 | activeBlockCenteringDuration={200} 40 | itemsPerRow={4} 41 | dragActivationTreshold={200} 42 | onDragRelease = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ", itemOrder) } 43 | onDragStart = { (key) => console.log("Some block is being dragged now!",key) }> 44 | { 45 | this.alphabets.map( (letter, index) => 46 | 48 | {letter} 50 | 51 | ) 52 | } 53 | 54 | 55 | } 56 | 57 | 58 | ``` 59 | - Merge on Grid Item Overlap 60 | ```javascript 61 | 62 | render(){ 63 | 64 | { 66 | this.sortGrid = sortGrid; 67 | }} 68 | blockTransitionDuration={400} 69 | activeBlockCenteringDuration={200} 70 | itemsPerRow={4} 71 | dragActivationTreshold={200} 72 | onDragRelease = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ", itemOrder) } 73 | onDragStart = { (key) => console.log("Some block is being dragged now!",key) } 74 | onMerge = {(itemKey,mergeBlockKey) => console.log("item and merge item",itemKey,mergeBlockKey)} 75 | merge={true}> 76 | { 77 | this.alphabets.map( (letter, index) => 78 | 80 | {letter} 82 | 83 | ) 84 | } 85 | 86 | 87 | } 88 | 89 | ``` 90 | - Delete Grid Items 91 | ```javascript 92 | 93 | onRemove(letter){ 94 | this.sortGrid.deleteBlockList(letter); 95 | } 96 | 97 | 98 | render() { 99 | return ( 100 | 101 | { 103 | this.sortGrid = sortGrid; 104 | }} 105 | blockTransitionDuration={400} 106 | activeBlockCenteringDuration={200} 107 | itemsPerRow={4} 108 | dragActivationTreshold={200} 109 | onDragRelease = { (itemOrder) => console.log("Drag was released, the blocks are in the following order: ",itemOrder)} onDragStart = { (key) => console.log("Some block is being dragged now!",key) } 110 | onDeleteItem = { (item) => console.log("Item was deleted:", item) }> 111 | { 112 | this.alphabets.map( (letter, index) => 113 | 115 | {letter} 117 | 118 | this.onRemove(letter)}> 121 | 128 | 129 | 130 | 131 | 132 | 133 | ) 134 | } 135 | 136 | 137 | ) 138 | } 139 | 140 | ``` 141 | -------------------------------------------------------------------------------- /__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /android/.gradle/4.10.2/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/.gradle/4.10.2/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/fileContent/fileContent.lock -------------------------------------------------------------------------------- /android/.gradle/4.10.2/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/gc.properties -------------------------------------------------------------------------------- /android/.gradle/4.10.2/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/javaCompile/jarAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/javaCompile/jarAnalysis.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /android/.gradle/4.10.2/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /android/.gradle/4.10.2/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/4.10.2/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /android/.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /android/.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Fri May 10 17:52:06 IST 2019 2 | gradle.version=4.10.2 3 | -------------------------------------------------------------------------------- /android/.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /android/.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/.gradle/vcs-1/gc.properties -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.dragdroplibrary", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.dragdroplibrary", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion rootProject.ext.compileSdkVersion 98 | 99 | compileOptions { 100 | sourceCompatibility JavaVersion.VERSION_1_8 101 | targetCompatibility JavaVersion.VERSION_1_8 102 | } 103 | 104 | defaultConfig { 105 | applicationId "com.dragdroplibrary" 106 | minSdkVersion rootProject.ext.minSdkVersion 107 | targetSdkVersion rootProject.ext.targetSdkVersion 108 | versionCode 1 109 | versionName "1.0" 110 | } 111 | splits { 112 | abi { 113 | reset() 114 | enable enableSeparateBuildPerCPUArchitecture 115 | universalApk false // If true, also generate a universal APK 116 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 117 | } 118 | } 119 | buildTypes { 120 | release { 121 | minifyEnabled enableProguardInReleaseBuilds 122 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 123 | } 124 | } 125 | // applicationVariants are e.g. debug, release 126 | applicationVariants.all { variant -> 127 | variant.outputs.each { output -> 128 | // For each separate APK per architecture, set a unique version code as described here: 129 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 130 | def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] 131 | def abi = output.getFilter(OutputFile.ABI) 132 | if (abi != null) { // null for the universal-debug, universal-release variants 133 | output.versionCodeOverride = 134 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 135 | } 136 | } 137 | } 138 | } 139 | 140 | dependencies { 141 | implementation project(':react-native-extra-dimensions-android') 142 | implementation fileTree(dir: "libs", include: ["*.jar"]) 143 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 144 | implementation "com.facebook.react:react-native:+" // From node_modules 145 | } 146 | 147 | // Run this once to be able to run the application with BUCK 148 | // puts all compile dependencies into folder libs for BUCK to use 149 | task copyDownloadableDepsToLibs(type: Copy) { 150 | from configurations.compile 151 | into 'libs' 152 | } 153 | -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/dragdroplibrary/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.dragdroplibrary; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "DragDropLibrary"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/dragdroplibrary/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.dragdroplibrary; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import ca.jaysoo.extradimensions.ExtraDimensionsPackage; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new ExtraDimensionsPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DragDropLibrary 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.3.1' 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'DragDropLibrary' 2 | include ':react-native-extra-dimensions-android' 3 | project(':react-native-extra-dimensions-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-extra-dimensions-android/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DragDropLibrary", 3 | "displayName": "DragDropLibrary" 4 | } -------------------------------------------------------------------------------- /assets/close_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/assets/close_white.png -------------------------------------------------------------------------------- /assets/close_white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/assets/close_white@2x.png -------------------------------------------------------------------------------- /assets/close_white@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/assets/close_white@3x.png -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/assets/icon.png -------------------------------------------------------------------------------- /assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/assets/splash.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/demo.gif -------------------------------------------------------------------------------- /drag-drop-lib/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"], 3 | "plugins": [ 4 | "transform-object-rest-spread", 5 | "transform-react-jsx" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /drag-drop-lib/Tile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { 3 | StyleSheet, 4 | Animated, 5 | TouchableWithoutFeedback, 6 | PanResponder, 7 | Image, 8 | View 9 | } from 'react-native'; 10 | import _ from 'lodash'; 11 | import { throttle } from 'lodash'; 12 | interface props { 13 | key?: any; 14 | style?: any; 15 | onLayout?: any; 16 | panHandlers?: any; 17 | delayLongPress?: any; 18 | onLongPress?: any; 19 | onPress?: any; 20 | itemWrapperStyle?: any; 21 | deletionView?: any; 22 | inactive?: any; 23 | } 24 | const ITEMS_PER_ROW = 4; 25 | const DRAG_ACTIVATION_THRESHOLD = 200; // Milliseconds 26 | const BLOCK_TRANSITION_DURATION = 300; // Milliseconds 27 | const ACTIVE_BLOCK_CENTERING_DURATION = 200; // Milliseconds 28 | const DOUBLE_TAP_THRESHOLD = 150; // Milliseconds 29 | const NULL_FN = () => {}; 30 | 31 | class Tile extends React.Component { 32 | constructor(props) { 33 | super(props); 34 | } 35 | 36 | public render() { 37 | return ( 38 | 43 | this.props.inactive || this.props.onLongPress()} 47 | onPress={() => this.props.inactive || this.props.onPress()} 48 | > 49 | 50 | {this.props.children} 51 | 52 | 53 | 54 | ); 55 | } 56 | } 57 | const styles = StyleSheet.create({ 58 | sortableGrid: { 59 | flexDirection: 'row', 60 | flexWrap: 'wrap' 61 | }, 62 | deletedBlock: { 63 | opacity: 0, 64 | position: 'absolute', 65 | left: 0, 66 | top: 0, 67 | height: 0, 68 | width: 0 69 | }, 70 | itemImageContainer: { 71 | flex: 1, 72 | justifyContent: 'center' 73 | } 74 | }); 75 | 76 | export default Tile; 77 | -------------------------------------------------------------------------------- /drag-drop-lib/built/Tile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = function (d, b) { 4 | extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 7 | return extendStatics(d, b); 8 | } 9 | return function (d, b) { 10 | extendStatics(d, b); 11 | function __() { this.constructor = d; } 12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13 | }; 14 | })(); 15 | var __importStar = (this && this.__importStar) || function (mod) { 16 | if (mod && mod.__esModule) return mod; 17 | var result = {}; 18 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 19 | result["default"] = mod; 20 | return result; 21 | }; 22 | Object.defineProperty(exports, "__esModule", { value: true }); 23 | var React = __importStar(require("react")); 24 | var react_native_1 = require("react-native"); 25 | var ITEMS_PER_ROW = 4; 26 | var DRAG_ACTIVATION_THRESHOLD = 200; // Milliseconds 27 | var BLOCK_TRANSITION_DURATION = 300; // Milliseconds 28 | var ACTIVE_BLOCK_CENTERING_DURATION = 200; // Milliseconds 29 | var DOUBLE_TAP_THRESHOLD = 150; // Milliseconds 30 | var NULL_FN = function () { }; 31 | var Tile = /** @class */ (function (_super) { 32 | __extends(Tile, _super); 33 | function Tile(props) { 34 | return _super.call(this, props) || this; 35 | } 36 | Tile.prototype.render = function () { 37 | var _this = this; 38 | return ( 39 | 40 | 41 | {this.props.children} 42 | 43 | 44 | ); 45 | }; 46 | return Tile; 47 | }(React.Component)); 48 | var styles = react_native_1.StyleSheet.create({ 49 | sortableGrid: { 50 | flexDirection: 'row', 51 | flexWrap: 'wrap' 52 | }, 53 | deletedBlock: { 54 | opacity: 0, 55 | position: 'absolute', 56 | left: 0, 57 | top: 0, 58 | height: 0, 59 | width: 0 60 | }, 61 | itemImageContainer: { 62 | flex: 1, 63 | justifyContent: 'center' 64 | } 65 | }); 66 | exports.default = Tile; 67 | //# sourceMappingURL=Tile.js.map -------------------------------------------------------------------------------- /drag-drop-lib/built/Tile.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Tile.js","sourceRoot":"","sources":["../Tile.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,6CAOsB;AAetB,IAAM,aAAa,GAAG,CAAC,CAAC;AACxB,IAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,eAAe;AACtD,IAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,eAAe;AACtD,IAAM,+BAA+B,GAAG,GAAG,CAAC,CAAC,eAAe;AAC5D,IAAM,oBAAoB,GAAG,GAAG,CAAC,CAAC,eAAe;AACjD,IAAM,OAAO,GAAG,cAAO,CAAC,CAAC;AAEzB;IAAmB,wBAA2B;IAC5C,cAAY,KAAK;eACf,kBAAM,KAAK,CAAC;IACd,CAAC;IAEM,qBAAM,GAAb;QAAA,iBAmBC;QAlBC,OAAO,CACD,CAAC,uBAAQ,CAAC,IAAI,CACZ,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CACxB,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAE7B;UAAA,CAAC,uCAAwB,CACvB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACnB,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAC1C,WAAW,CAAC,CAAC,cAAM,OAAA,KAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAA/C,CAA+C,CAAC,CACnE,OAAO,CAAC,CAAC,cAAM,OAAA,KAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAA3C,CAA2C,CAAC,CAE7D;UAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CACvC;UAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,mBAAI,CACrE;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,uCAAwB,CAC5B;MAAA,EAAE,uBAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;IACJ,CAAC;IACH,WAAC;AAAD,CAAC,AAzBD,CAAmB,KAAK,CAAC,SAAS,GAyBjC;AACD,IAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,YAAY,EAAE;QACZ,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,MAAM;KACjB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC;AAEH,kBAAe,IAAI,CAAC"} -------------------------------------------------------------------------------- /drag-drop-lib/built/dragDropGrid.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = function (d, b) { 4 | extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 7 | return extendStatics(d, b); 8 | } 9 | return function (d, b) { 10 | extendStatics(d, b); 11 | function __() { this.constructor = d; } 12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 13 | }; 14 | })(); 15 | var __importStar = (this && this.__importStar) || function (mod) { 16 | if (mod && mod.__esModule) return mod; 17 | var result = {}; 18 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 19 | result["default"] = mod; 20 | return result; 21 | }; 22 | var __importDefault = (this && this.__importDefault) || function (mod) { 23 | return (mod && mod.__esModule) ? mod : { "default": mod }; 24 | }; 25 | Object.defineProperty(exports, "__esModule", { value: true }); 26 | var React = __importStar(require("react")); 27 | var react_native_1 = require("react-native"); 28 | var Tile_1 = __importDefault(require("./Tile")); 29 | var lodash_1 = __importDefault(require("lodash")); 30 | var lodash_2 = require("lodash"); 31 | // import block from './block'; 32 | // Default values 33 | var ITEMS_PER_ROW = 4; 34 | var DRAG_ACTIVATION_THRESHOLD = 200; // Milliseconds 35 | var BLOCK_TRANSITION_DURATION = 300; // Milliseconds 36 | var ACTIVE_BLOCK_CENTERING_DURATION = 200; // Milliseconds 37 | var DOUBLE_TAP_THRESHOLD = 150; // Milliseconds 38 | var NULL_FN = function () { }; 39 | var DragDropGrid = /** @class */ (function (_super) { 40 | __extends(DragDropGrid, _super); 41 | function DragDropGrid(props) { 42 | var _this = _super.call(this, props) || this; 43 | _this.onBlockPress = function (key) { 44 | if (_this.tapIgnore) 45 | _this._resetTapIgnoreTime(); 46 | }; 47 | _this.toggleDeleteMode = function () { 48 | var deleteModeOn = !_this.state.deleteModeOn; 49 | _this.setState({ deleteModeOn: deleteModeOn }); 50 | return { deleteModeOn: deleteModeOn }; 51 | }; 52 | _this.handleNewPropsWithoutDelete = function (properties) { 53 | _this.itemsPerRow = _this.props.itemsPerRow; 54 | _this.dragActivationThreshold = _this.props.dragActivationTreshold; 55 | _this.dragStartAnimation = _this.props.dragStartAnimation; 56 | _this._assignReceivedPropertiesIntoThis(properties); 57 | _this._saveItemOrder(properties.children); 58 | }; 59 | _this.handleNewProps = function (properties) { 60 | _this.itemsPerRow = _this.props.itemsPerRow; 61 | _this.dragActivationThreshold = _this.props.dragActivationTreshold; 62 | _this.dragStartAnimation = _this.props.dragStartAnimation; 63 | _this._assignReceivedPropertiesIntoThis(properties); 64 | _this._saveItemOrder(properties.children); 65 | _this._removeDisappearedChildren(properties.children); 66 | }; 67 | _this.onStartDrag = function (evt, gestureState) { 68 | if (_this.state.activeBlock != null) { 69 | var activeBlockPosition = _this._getActiveBlock().origin; 70 | var x = activeBlockPosition.x - gestureState.x0; 71 | var y = activeBlockPosition.y - gestureState.y0; 72 | _this.activeBlockOffset = { x: x, y: y }; 73 | _this.initialDragDone = true; 74 | _this._getActiveBlock().currentPosition.setOffset({ x: x, y: y }); 75 | _this._getActiveBlock().currentPosition.setValue({ 76 | x: gestureState.moveX, 77 | y: gestureState.moveY 78 | }); 79 | } 80 | }; 81 | _this.onMoveBlock = function (evt, _a) { 82 | var moveX = _a.moveX, moveY = _a.moveY, dx = _a.dx, dy = _a.dy; 83 | if (_this.state.activeBlock != null && _this._blockPositionsSet()) { 84 | if (_this.state.deleteModeOn) 85 | return _this.deleteModeMove({ x: moveX, y: moveY }); 86 | if (dx != 0 || dy != 0) 87 | _this.initialDragDone = true; 88 | var yChokeAmount = Math.max(0, _this.activeBlockOffset.y + moveY - (_this.state.gridLayout.height - _this.blockHeight)); 89 | var xChokeAmount = Math.max(0, _this.activeBlockOffset.x + moveX - (_this.state.gridLayout.width - _this.blockWidth)); 90 | var yMinChokeAmount = Math.min(0, _this.activeBlockOffset.y + moveY); 91 | var xMinChokeAmount = Math.min(0, _this.activeBlockOffset.x + moveX); 92 | var dragPosition = { 93 | x: moveX - xChokeAmount - xMinChokeAmount, 94 | y: moveY - yChokeAmount - yMinChokeAmount 95 | }; 96 | _this.dragPosition = dragPosition; 97 | _this._getActiveBlock().currentPosition.setValue(dragPosition); 98 | if (dx != 0 || dy != 0) 99 | _this.initialDragDone = true; 100 | _this.moveAnim(_this.state.activeBlock, _this.blockPositions, _this.itemOrder, _this.state.mergeBlock); 101 | } 102 | }; 103 | _this.moveAnim = lodash_2.throttle(function (activeBlock, bp, itemOrder, mergeBlock) { 104 | if (!_this.release) { 105 | var closest_1 = activeBlock; 106 | var originalPosition = _this._getActiveBlock().origin; 107 | var distanceToOrigin = _this._getDistanceTo(originalPosition); 108 | var closestDistance_1 = distanceToOrigin; 109 | var merge_1 = false; 110 | _this.blockPositions && 111 | _this.blockPositions.forEach(function (block, index) { 112 | if (index !== activeBlock && block.origin) { 113 | var blockPosition = block.origin; 114 | var distance = _this._getDistanceTo(blockPosition); 115 | //condition to avoid "+" block 116 | //condition to check whether block has come close to any other block 117 | if (distance < closestDistance_1 && distance < _this.state.blockWidth) { 118 | closest_1 = index; 119 | closestDistance_1 = distance; 120 | //this is the condition for group creation(mergeblock) 121 | if (_this.props.merge) { 122 | if (distance < _this.state.blockWidth / 3) { 123 | var arr1 = []; 124 | if (closest_1 != mergeBlock) { 125 | //if already an mergeblock exist get it to actual size 126 | if (mergeBlock != null) { 127 | react_native_1.Animated.spring(bp[mergeBlock].pop, { 128 | toValue: 0, 129 | tension: 40, 130 | friction: 3 131 | }).start(); 132 | } 133 | arr1.push(react_native_1.Animated.spring(bp[activeBlock].hoverPop, { 134 | toValue: -1, 135 | tension: 40, 136 | friction: 3 137 | })); 138 | arr1.push(react_native_1.Animated.spring(bp[closest_1].pop, { 139 | toValue: -1, 140 | tension: 40, 141 | friction: 3 142 | })); 143 | react_native_1.Animated.parallel(arr1).start(); 144 | } 145 | merge_1 = true; 146 | } 147 | } 148 | } 149 | } 150 | }); 151 | _this.merge = merge_1; 152 | if (!merge_1) { 153 | var arr = []; 154 | //if there no mergegroup gesture the reposition already existing mergeblock 155 | //create empty blocks (for remaing space) 156 | _this.ghostBlocks && 157 | _this.ghostBlocks.forEach(function (ghostBlockPosition) { 158 | var distance = _this._getDistanceTo(ghostBlockPosition); 159 | if (distance < closestDistance_1) { 160 | closest_1 = activeBlock; 161 | closestDistance_1 = distance; 162 | } 163 | }); 164 | //this is for reposition animation 165 | if (closest_1 !== activeBlock) { 166 | var date = new Date(); 167 | var timestamp = date.getTime(); 168 | var increment_1 = _this.itemOrder[closest_1].order < _this.itemOrder[activeBlock].order ? -1 : 1; 169 | var arr = []; 170 | var toPos, pos; 171 | var closetOrder = _this.itemOrder[closest_1].order; 172 | var activeOrder = _this.itemOrder[activeBlock].order; 173 | var blockPositions = bp; 174 | var _loop_1 = function (k) { 175 | itemOrder && 176 | itemOrder.forEach(function (item, index) { 177 | if (item.order == k) { 178 | toPos = index; 179 | } 180 | if (item.order == k + increment_1) { 181 | pos = index; 182 | } 183 | }); 184 | arr.push(react_native_1.Animated.timing(bp[pos].currentPosition, { 185 | toValue: bp[toPos].origin, 186 | duration: _this.props.blockTransitionDuration 187 | })); 188 | }; 189 | //repostion animation for the blocks which are supposed to be repositioned (zig zag animation) 190 | for (var k = activeOrder; k != closetOrder; k += increment_1) { 191 | _loop_1(k); 192 | } 193 | if (mergeBlock != null) { 194 | arr.push(react_native_1.Animated.spring(bp[mergeBlock].pop, { 195 | toValue: 0, 196 | tension: 40, 197 | friction: 3 198 | })); 199 | arr.push(react_native_1.Animated.spring(bp[activeBlock].hoverPop, { 200 | toValue: 1, 201 | tension: 40, 202 | friction: 3 203 | })); 204 | } 205 | //this part repositions all the blocks saves their respected positions and offesets 206 | var dup_array = _this.deepCopy(_this.orderItem); 207 | var currPos = blockPositions[closest_1].origin; 208 | var tempOrderIndex = _this.itemOrder[closest_1].order; 209 | for (var k = closetOrder; k != activeOrder; k -= increment_1) { 210 | toPos = _this.orderItem[k].order; 211 | pos = _this.orderItem[k - increment_1].order; 212 | blockPositions[toPos].origin = blockPositions[pos].origin; 213 | _this.itemOrder[toPos].order = _this.itemOrder[pos].order; 214 | dup_array[k - increment_1].order = toPos; 215 | } 216 | blockPositions[activeBlock].origin = currPos; 217 | dup_array[closetOrder].order = activeBlock; 218 | _this.orderItem = dup_array; 219 | _this.itemOrder[activeBlock].order = tempOrderIndex; 220 | _this.blockPositions = blockPositions; 221 | react_native_1.Animated.parallel(arr).start(); 222 | } 223 | } 224 | else if (closest_1 != mergeBlock) { 225 | _this.setState({ mergeBlock: closest_1 }); 226 | } 227 | } 228 | }, 400); 229 | _this.onReleaseBlock = function (evt, gestureState) { 230 | _this.release = true; 231 | _this.moveAnim.cancel(); 232 | _this.returnBlockToOriginalPosition(); 233 | _this.afterDragRelease(); 234 | _this.merge = false; 235 | }; 236 | _this.deleteBlockList = function (key) { 237 | _this.key = key; 238 | var activeKey = lodash_1.default.findKey(_this.itemOrder, function (oldItem) { return oldItem.key == key; }); 239 | var activeBlock = activeKey; 240 | _this.deleteBlocks([activeBlock]); 241 | _this.afterDragRelease(); 242 | }; 243 | _this.blockAnimateFadeOut = function () { 244 | _this.state.deleteBlockOpacity.setValue(1); 245 | return new Promise(function (resolve, reject) { 246 | react_native_1.Animated.timing(_this.state.deleteBlockOpacity, { 247 | toValue: 0, 248 | duration: 2 * _this.props.activeBlockCenteringDuration 249 | }).start(resolve); 250 | }); 251 | }; 252 | _this.animateBlockMove = function (blockIndex, position) { 253 | return react_native_1.Animated.timing(_this._getBlock(blockIndex).currentPosition, { 254 | toValue: position, 255 | duration: _this.props.blockTransitionDuration 256 | }); 257 | }; 258 | _this.returnBlockToOriginalPosition = function () { 259 | _this.repositionMergeBlockAndUpdate(); 260 | if (_this.state.mergeBlock != null) { 261 | react_native_1.Animated.spring(_this.blockPositions[_this.state.mergeBlock].pop, { 262 | toValue: 0, 263 | tension: 40, 264 | friction: 3 265 | }).start(); 266 | } 267 | _this.repostionBlocks(); 268 | _this.repositionActiveBlock(); 269 | _this.merge = false; 270 | }; 271 | _this.afterDragRelease = function () { 272 | var itemOrder = lodash_1.default.sortBy(_this.itemOrder, function (item) { return item.order; }); 273 | var orderItem = lodash_1.default.sortBy(_this.orderItem, function (item) { return item.order; }); 274 | _this.props.onDragRelease && _this.props.onDragRelease({ itemOrder: itemOrder }); 275 | _this.setState({ activeBlock: null }); 276 | _this.setState({ mergeBlock: null }); 277 | _this.panCapture = false; 278 | }; 279 | _this.deleteModeMove = function (_a) { 280 | var x = _a.x, y = _a.y; 281 | var slideDistance = 50; 282 | var moveY = y + _this.activeBlockOffset.y - _this._getActiveBlock().origin.y; 283 | var adjustY = 0; 284 | if (moveY < 0) 285 | adjustY = moveY; 286 | else if (moveY > slideDistance) 287 | adjustY = moveY - slideDistance; 288 | var deletionSwipePercent = ((moveY - adjustY) / slideDistance) * 100; 289 | _this._getActiveBlock().currentPosition.y.setValue(y - adjustY); 290 | _this.setState({ deletionSwipePercent: deletionSwipePercent }); 291 | }; 292 | _this.reAssessGridRows = function () { 293 | var oldRows = _this.rows; 294 | _this.rows = Math.ceil(_this.items.length / _this.itemsPerRow); 295 | if (_this.state.blockWidth && oldRows != _this.rows) 296 | _this._animateGridHeight(); 297 | }; 298 | _this.saveBlockPositions = function (key) { return function (_a) { 299 | var nativeEvent = _a.nativeEvent; 300 | var blockPositions = _this.blockPositions; 301 | if (!blockPositions[key]) { 302 | var blockPositionsSetCount = blockPositions[key] 303 | ? _this.blockPositionsSetCount 304 | : ++_this.blockPositionsSetCount; 305 | var thisPosition = { 306 | x: nativeEvent.layout.x, 307 | y: nativeEvent.layout.y 308 | }; 309 | blockPositions[key] = { 310 | currentPosition: new react_native_1.Animated.ValueXY(thisPosition), 311 | origin: thisPosition, 312 | pop: new react_native_1.Animated.Value(0), 313 | hoverPop: new react_native_1.Animated.Value(0) 314 | }; 315 | if (_this._blockPositionsSet()) { 316 | _this.blockPositions = blockPositions; 317 | _this.setGhostPositions(); 318 | _this.initialLayoutDone = true; 319 | } 320 | } 321 | }; }; 322 | _this.getNextBlockCoordinates = function () { 323 | var blockWidth = _this.state.blockWidth; 324 | var blockHeight = _this.state.blockHeight; 325 | var placeOnRow = _this.items.length % _this.itemsPerRow; 326 | var y = blockHeight * Math.floor(_this.items.length / _this.itemsPerRow) + 20; 327 | var x = placeOnRow * blockWidth; 328 | return { x: x, y: y }; 329 | }; 330 | _this.setGhostPositions = function () { 331 | _this.ghostBlocks = []; 332 | _this.reAssessGridRows(); 333 | var blockWidth = _this.state.blockWidth; 334 | var blockHeight = _this.state.blockHeight; 335 | var fullGridItemCount = _this.rows * _this.itemsPerRow; 336 | var ghostBlockCount = fullGridItemCount - _this.items.length; 337 | var y = blockHeight * (_this.rows - 1); 338 | var initialX = blockWidth * (_this.itemsPerRow - ghostBlockCount); 339 | for (var i = 0; i < ghostBlockCount; ++i) { 340 | var x = initialX + blockWidth * i; 341 | _this.ghostBlocks.push({ x: x, y: y }); 342 | } 343 | }; 344 | _this.activateDrag = function (key) { return function () { 345 | _this.release = false; 346 | _this.props.onDragStart(key); 347 | var favKey = _this.items[key].key; 348 | _this.panCapture = true; 349 | _this.setState({ activeBlock: key }); 350 | _this._defaultDragActivationWiggle(); 351 | }; }; 352 | _this.handleTap = function (_a, key) { 353 | var _b = _a.onTap, onTap = _b === void 0 ? NULL_FN : _b, _c = _a.onDoubleTap, onDoubleTap = _c === void 0 ? NULL_FN : _c; 354 | return function () { 355 | if (_this.tapIgnore) 356 | _this._resetTapIgnoreTime(); 357 | else if (onDoubleTap != null) { 358 | _this.doubleTapWait ? _this._onDoubleTap(onDoubleTap) : _this._onSingleTap(onTap); 359 | } 360 | else 361 | onTap(); 362 | }; 363 | }; 364 | // Helpers & other boring stuff 365 | _this._getActiveBlock = function () { return _this.blockPositions[_this.state.activeBlock]; }; 366 | _this._getBlock = function (blockIndex) { return _this.blockPositions[blockIndex]; }; 367 | _this._blockPositionsSet = function () { return _this.blockPositionsSetCount == _this.items.length; }; 368 | //when the items added or deleted from the backend we maitain it 369 | _this._saveItemOrder = function (items) { 370 | items && 371 | items.forEach(function (item, index) { 372 | var foundKey = lodash_1.default.findKey(_this.itemOrder, function (oldItem) { return oldItem.key == item.key; }); 373 | if (foundKey) { 374 | _this.items[foundKey] = item; 375 | } 376 | else { 377 | _this.itemOrder.push({ key: item.key, ref: item.ref, order: _this.items.length }); 378 | _this.orderItem.push({ 379 | key: item.key, 380 | ref: item.ref, 381 | order: _this.items.length, 382 | originKey: _this.items.length 383 | }); 384 | if (!_this.initialLayoutDone) { 385 | _this.items.push(item); 386 | } 387 | else { 388 | var blockPositionsSetCount = ++_this.blockPositionsSetCount; 389 | var thisPosition = _this.getNextBlockCoordinates(); 390 | _this.blockPositions.push({ 391 | currentPosition: new react_native_1.Animated.ValueXY(thisPosition), 392 | origin: thisPosition, 393 | pop: new react_native_1.Animated.Value(0), 394 | hoverPop: new react_native_1.Animated.Value(0) 395 | }); 396 | _this.items.push(item); 397 | _this.setGhostPositions(); 398 | } 399 | } 400 | }); 401 | }; 402 | _this._removeDisappearedChildren = function (items) { 403 | var deleteBlockIndices = []; 404 | _this.itemOrder && 405 | lodash_1.default.cloneDeep(_this.itemOrder).forEach(function (item, index) { 406 | if (!lodash_1.default.findKey(items, function (oldItem) { return oldItem.key == item.key; })) { 407 | deleteBlockIndices.push(index); 408 | } 409 | }); 410 | if (deleteBlockIndices.length > 0) { 411 | _this.deleteBlocks(deleteBlockIndices); 412 | } 413 | }; 414 | _this.deleteBlocks = function (deleteBlockIndices) { 415 | var blockPositionsSetCount = _this.blockPositionsSetCount; 416 | lodash_1.default.sortBy(deleteBlockIndices, function (index) { return -index; }).forEach(function (index) { 417 | --blockPositionsSetCount; 418 | var order = _this.itemOrder[index].order; 419 | _this.blockPositions.splice(index, 1); 420 | var indexOrder = _this.findIndex(_this.orderItem, index); 421 | _this._fixItemOrderOnDeletion(_this.itemOrder[index]); 422 | _this.orderItem.splice(indexOrder, 1); 423 | _this.itemOrder.splice(index, 1); 424 | _this._fixOrderItemOnDeletion(_this.itemOrder); 425 | _this.items.splice(index, 1); 426 | }); 427 | var arr = []; 428 | _this.blockPositionsSetCount = blockPositionsSetCount; 429 | _this.items && 430 | _this.items.forEach(function (item, order) { 431 | var blockIndex = lodash_1.default.findKey(_this.itemOrder, function (item) { return item.order == order; }); 432 | var x = (order * _this.state.blockWidth) % (_this.itemsPerRow * _this.state.blockWidth); 433 | var y = Math.floor(order / _this.itemsPerRow) * _this.state.blockHeight + 20; 434 | _this.blockPositions[blockIndex].origin = { x: x, y: y }; 435 | if (_this.key == null) { 436 | _this.blockPositions[blockIndex].currentPosition = new react_native_1.Animated.ValueXY({ x: x, y: y }); 437 | } 438 | else 439 | arr.push(_this.animateBlockMove(blockIndex, { x: x, y: y })); 440 | }); 441 | if (arr.length > 0) { 442 | react_native_1.Animated.parallel(arr).start(function () { 443 | if (_this.key != null) 444 | _this.props.onDeleteItem(_this.key); 445 | _this.key = null; 446 | _this.setGhostPositions(); 447 | }); 448 | } 449 | else { 450 | _this.setGhostPositions(); 451 | } 452 | }; 453 | _this._fixItemOrderOnDeletion = function (orderItem) { 454 | if (!orderItem) 455 | return false; 456 | orderItem.order--; 457 | _this._fixItemOrderOnDeletion(lodash_1.default.find(_this.itemOrder, function (item) { return item.order == orderItem.order + 2; })); 458 | }; 459 | _this._fixOrderItemOnDeletion = function (itemOrder) { 460 | var orderItem = _this.orderItem; 461 | for (var i = 0; i < itemOrder.length; i++) { 462 | orderItem[itemOrder[i].order].order = i; 463 | } 464 | _this.orderItem = orderItem; 465 | }; 466 | _this._animateGridHeight = function () { 467 | _this.gridHeightTarget = _this.rows * _this.state.blockHeight; 468 | if (_this.gridHeightTarget == _this.state.gridLayout.height || _this.state.gridLayout.height == 0) 469 | _this.state.gridHeight.setValue(_this.gridHeightTarget); 470 | else if (_this.state.gridHeight._value !== _this.gridHeightTarget) { 471 | react_native_1.Animated.timing(_this.state.gridHeight, { 472 | toValue: _this.gridHeightTarget, 473 | duration: _this.props.blockTransitionDuration 474 | }).start(); 475 | } 476 | }; 477 | _this._getDistanceTo = function (point) { 478 | var xDistance = _this.dragPosition.x + _this.activeBlockOffset.x - point.x; 479 | var yDistance = _this.dragPosition.y + _this.activeBlockOffset.y - point.y; 480 | return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2)); 481 | }; 482 | _this._defaultDragActivationWiggle = function () { 483 | if (!_this.props.dragStartAnimation) { 484 | var activeBlock = _this._getActiveBlock(); 485 | react_native_1.Animated.spring(activeBlock.hoverPop, { 486 | toValue: 1, 487 | friction: 3, 488 | tension: 40 489 | }).start(function () { }); 490 | } 491 | }; 492 | _this._blockActivationWiggle = function (key) { 493 | return (_this.props.dragStartAnimation || { 494 | transform: [ 495 | { 496 | scale: _this._getBlock(key).hoverPop.interpolate({ 497 | inputRange: [-1, 0, 1], 498 | outputRange: [0.8, 1, 1.3] 499 | }) 500 | } 501 | ] 502 | }); 503 | }; 504 | _this._onSingleTap = function (onTap) { 505 | _this.doubleTapWait = true; 506 | _this.tapTimer = setTimeout(function () { 507 | _this.doubleTapWait = false; 508 | onTap(); 509 | }, _this.doubleTapTreshold); 510 | }; 511 | _this._onDoubleTap = function (onDoubleTap) { 512 | _this._resetTapIgnoreTime(); 513 | _this.doubleTapWait = false; 514 | _this.tapIgnore = true; 515 | onDoubleTap(); 516 | }; 517 | _this._resetTapIgnoreTime = function () { 518 | clearTimeout(_this.tapTimer); 519 | _this.tapTimer = setTimeout(function () { return (_this.tapIgnore = false); }, _this.props.doubleTapThreshold); 520 | }; 521 | _this.onActiveBlockIsSet = function (fn) { return function (evt, gestureState) { 522 | if (_this.state.activeBlock != null) 523 | fn(evt, gestureState); 524 | }; }; 525 | _this._getImageDeleteIconStyle = function (key) { return [ 526 | { 527 | position: 'absolute', 528 | top: _this.state.blockHeight / 2 - 15, 529 | left: _this.state.blockWidth / 2 - 15, 530 | width: 30, 531 | height: 30, 532 | opacity: .5 533 | }, 534 | _this.state.activeBlock == key 535 | && _this._getBlock(key).origin && 536 | { opacity: .5 + _this._getDynamicOpacity(key) } 537 | ]; }; 538 | _this._getGridStyle = function () { return [ 539 | styles.sortableGrid, 540 | _this.props.style, 541 | _this._blockPositionsSet() && { height: _this.state.gridHeight } 542 | ]; }; 543 | _this._getItemWrapperStyle = function (key) { return [ 544 | { flex: 1 }, 545 | _this.state.activeBlock == key && 546 | _this.state.deleteModeOn && 547 | _this._getBlock(key).origin && { opacity: 1.5 - _this._getDynamicOpacity(key) } 548 | ]; }; 549 | _this._getDynamicOpacity = function (key) { 550 | return (_this._getBlock(key).currentPosition.y._value + 551 | _this._getBlock(key).currentPosition.y._offset - 552 | _this._getBlock(key).origin.y) / 553 | 50; 554 | }; 555 | _this._getBlockStyle = function (key) { return [ 556 | { 557 | width: _this.state.blockWidth, 558 | height: _this.state.blockHeight, 559 | justifyContent: 'center' 560 | }, 561 | _this._blockPositionsSet() && { 562 | position: 'absolute', 563 | top: _this._getBlock(key).currentPosition.getLayout().top, 564 | left: _this._getBlock(key).currentPosition.getLayout().left, 565 | transform: [ 566 | { 567 | scale: _this._getBlock(key).pop.interpolate({ 568 | inputRange: [-1, 0, 1], 569 | outputRange: [0.5, 1, 1] 570 | }) 571 | }, 572 | { 573 | translateY: _this._getBlock(key).pop.interpolate({ 574 | inputRange: [-1, 0, 1], 575 | outputRange: [-1 * 50, 0, 0] 576 | }) 577 | } 578 | ] 579 | }, 580 | _this.state.activeBlock == key && _this._blockActivationWiggle(key), 581 | _this.state.activeBlock == key && { zIndex: 1 }, 582 | _this.state.deleteBlock != null && { zIndex: 2 }, 583 | _this.state.deleteBlock == key && { opacity: _this.state.deleteBlockOpacity }, 584 | ]; }; 585 | _this.state = { 586 | gridLayout: null, 587 | random: null, 588 | startDragWiggle: new react_native_1.Animated.Value(0), 589 | activeBlock: null, 590 | mergeBlock: null, 591 | blockWidth: null, 592 | blockHeight: null, 593 | gridHeight: new react_native_1.Animated.Value(0), 594 | deleteModeOn: false, 595 | deletionSwipePercent: 0, 596 | deleteBlock: null, 597 | deleteBlockOpacity: new react_native_1.Animated.Value(1), 598 | deletedItems: [] 599 | }; 600 | _this.itemsPerRow = _this.props.itemsPerRow; 601 | _this.dragActivationThreshold = _this.props.dragActivationTreshold; 602 | _this.dragStartAnimation = _this.props.dragStartAnimation; 603 | _this.doubleTapTreshold = DOUBLE_TAP_THRESHOLD; 604 | _this._panResponder = null; 605 | _this.rows = null; 606 | _this.dragPosition = null; 607 | _this.activeBlockOffset = null; 608 | _this.blockWidth = null; 609 | _this.blockPositionsSetCount = 0; 610 | _this.blockHeight = null; 611 | _this.blockPositions = []; 612 | _this.toggleDeleteMode = _this.toggleDeleteMode.bind(_this); 613 | _this.gridHeightTarget = null; 614 | _this.ghostBlocks = []; 615 | _this.itemOrder = []; 616 | _this.showAddNew = false; 617 | _this.orderItem = []; 618 | _this.merge = false; 619 | _this.panCapture = false; 620 | _this.items = []; 621 | _this.initialLayoutDone = false; 622 | _this.initialDragDone = false; 623 | _this.config = { tension: 40, friction: 3 }; 624 | _this.tapTimer = null; 625 | _this.tapIgnore = false; 626 | _this.doubleTapWait = false; 627 | _this.assessGridSize = _this.assessGridSize.bind(_this); 628 | _this.release = false; 629 | _this.key = null; 630 | _this._getGridStyle = _this._getGridStyle.bind(_this); 631 | _this._getBlockStyle = _this._getBlockStyle.bind(_this); 632 | _this.saveBlockPositions = _this.saveBlockPositions.bind(_this); 633 | _this.activateDrag = _this.activateDrag.bind(_this); 634 | _this.handleTap = _this.handleTap.bind(_this); 635 | _this.onBlockPress = _this.onBlockPress.bind(_this); 636 | _this._getItemWrapperStyle = _this._getItemWrapperStyle.bind(_this); 637 | _this.deleteBlockList = _this.deleteBlockList.bind(_this); 638 | return _this; 639 | } 640 | DragDropGrid.prototype.render = function () { 641 | var _this = this; 642 | return ( 643 | {this.state.gridLayout && 644 | this.blockPositions && 645 | this.items.map(function (item, key) { return ( 646 | {item} 647 | ); })} 648 | ); 649 | }; 650 | DragDropGrid.prototype.componentDidMount = function () { 651 | this.createTouchHandlers(); 652 | this.handleNewProps(this.props); 653 | }; 654 | DragDropGrid.prototype.componentWillUnmount = function () { 655 | if (this.tapTimer) 656 | clearTimeout(this.tapTimer); 657 | }; 658 | DragDropGrid.prototype.componentDidUpdate = function (prevProps) { 659 | if (prevProps != this.props) { 660 | this.handleNewProps(this.props); 661 | } 662 | }; 663 | DragDropGrid.prototype.repostionBlocks = function () { 664 | var arr = []; 665 | var bp = this.blockPositions; 666 | for (var i = 0; i < bp.length; i++) { 667 | react_native_1.Animated.timing(bp[i].currentPosition, { 668 | toValue: bp[i].origin, 669 | duration: this.props.activeBlockCenteringDuration 670 | }).start(); 671 | } 672 | }; 673 | DragDropGrid.prototype.repositionMergeBlockAndUpdate = function () { 674 | if (this.props.merge) { 675 | var closest = this.state.activeBlock; 676 | var originalPosition = this._getActiveBlock().origin; 677 | var distanceToOrigin = this._getDistanceTo(originalPosition); 678 | var closestDistance = distanceToOrigin; 679 | var bp = this.blockPositions; 680 | var mergeBlock = this.state.mergeBlock; 681 | var activeBlock = this.state.activeBlock; 682 | if (mergeBlock != null) { 683 | var blockPosition = this._getBlock(mergeBlock).origin; 684 | var distance = this._getDistanceTo(blockPosition); 685 | if (distance < closestDistance && distance < this.state.blockWidth / 4) { 686 | this.props.onMerge(this.items[activeBlock].key, this.items[mergeBlock].key); 687 | } 688 | react_native_1.Animated.spring(bp[mergeBlock].pop, { 689 | toValue: 0, 690 | tension: 40, 691 | friction: 3 692 | }).start(); 693 | } 694 | } 695 | }; 696 | DragDropGrid.prototype.repositionActiveBlock = function () { 697 | var activeBlockCurrentPosition = this._getActiveBlock().currentPosition; 698 | activeBlockCurrentPosition.flattenOffset(); 699 | var toValueAnim = this._getActiveBlock().origin; 700 | var hoverPopOfItem = this._getActiveBlock().hoverPop; 701 | hoverPopOfItem.stopAnimation(); 702 | react_native_1.Animated.timing(activeBlockCurrentPosition, { 703 | toValue: toValueAnim, 704 | duration: this.props.activeBlockCenteringDuration 705 | }).start(); 706 | react_native_1.Animated.spring(hoverPopOfItem, { 707 | toValue: 0, 708 | tension: 40, 709 | friction: 3 710 | }).start(); 711 | }; 712 | DragDropGrid.prototype.assessGridSize = function (_a) { 713 | var nativeEvent = _a.nativeEvent; 714 | if (this.props.itemWidth < nativeEvent.layout.width) { 715 | this.itemsPerRow = Math.floor(nativeEvent.layout.width / this.props.itemWidth); 716 | this.blockWidth = nativeEvent.layout.width / this.itemsPerRow; 717 | this.blockHeight = this.props.itemHeight || this.blockWidth; 718 | } 719 | else { 720 | this.blockWidth = nativeEvent.layout.width / this.itemsPerRow; 721 | this.blockHeight = this.blockWidth; 722 | } 723 | if (this.state.gridLayout != nativeEvent.layout) { 724 | this.setState({ 725 | gridLayout: nativeEvent.layout, 726 | blockWidth: this.blockWidth, 727 | blockHeight: this.blockHeight 728 | }); 729 | } 730 | }; 731 | DragDropGrid.prototype.deepCopy = function (arr) { 732 | var out = []; 733 | for (var i = 0, len = arr.length; i < len; i++) { 734 | var item = arr[i]; 735 | var obj = {}; 736 | for (var k in item) { 737 | obj[k] = item[k]; 738 | } 739 | out.push(obj); 740 | } 741 | return out; 742 | }; 743 | DragDropGrid.prototype.deleteDisapearedItems = function (items) { 744 | var _this = this; 745 | var deleteBlockIndices = []; 746 | var blockPositions = this.blockPositions; 747 | var blockPositionsSetCount = this.blockPositionsSetCount; 748 | this.itemOrder && 749 | lodash_1.default.cloneDeep(this.itemOrder).forEach(function (item, index) { 750 | if (!lodash_1.default.findKey(items, function (oldItem) { return oldItem.key == item.key; })) { 751 | deleteBlockIndices.push(index); 752 | } 753 | }); 754 | if (deleteBlockIndices.length > 0) { 755 | deleteBlockIndices && 756 | lodash_1.default.sortBy(deleteBlockIndices, function (index) { return -index; }).forEach(function (index) { 757 | --blockPositionsSetCount; 758 | var order = _this.itemOrder[index].order; 759 | blockPositions.splice(index, 1); 760 | var indexOrder = _this.findIndex(_this.orderItem, index); 761 | _this._fixItemOrderOnDeletion(_this.itemOrder[index]); 762 | _this.orderItem.splice(indexOrder, 1); 763 | _this.itemOrder.splice(index, 1); 764 | _this._fixOrderItemOnDeletion(_this.itemOrder); 765 | _this.items.splice(index, 1); 766 | }); 767 | this.blockPositionsSetCount = blockPositionsSetCount; 768 | return blockPositions; 769 | } 770 | }; 771 | DragDropGrid.prototype.isNotEqual = function (items, currentItems) { 772 | for (var i = 0; i < items.length; i++) { 773 | if (items[i].key != currentItems[i].key) { 774 | return true; 775 | } 776 | } 777 | return false; 778 | }; 779 | DragDropGrid.prototype.unloadLastTile = function () { 780 | if (this.blockPositions.length > 0) { 781 | this.itemOrder.splice(this.itemOrder.length - 1, 1); 782 | this.orderItem.splice(this.orderItem.length - 1, 1); 783 | this.items.splice(this.items.length - 1, 1); 784 | this.blockPositions.splice(this.blockPositions.length - 1, 1); 785 | this.blockPositionsSetCount = this.blockPositionsSetCount - 1; 786 | } 787 | }; 788 | DragDropGrid.prototype.findIndex = function (orderItem, key) { 789 | for (var i = 0; i < orderItem.length; i++) { 790 | if (orderItem[i].order == key) { 791 | return i; 792 | } 793 | } 794 | return -1; 795 | }; 796 | DragDropGrid.prototype._assignReceivedPropertiesIntoThis = function (properties) { 797 | var _this = this; 798 | properties && 799 | Object.keys(properties).forEach(function (property) { 800 | if (_this[property]) 801 | _this[property] = properties[property]; 802 | }); 803 | this.dragStartAnimation = properties.dragStartAnimation; 804 | }; 805 | DragDropGrid.prototype.createTouchHandlers = function () { 806 | var _this = this; 807 | this._panResponder = react_native_1.PanResponder.create({ 808 | onPanResponderTerminate: function (evt, gestureState) { }, 809 | onStartShouldSetPanResponder: function (evt, gestureState) { return true; }, 810 | onStartShouldSetPanResponderCapture: function (evt, gestureState) { return false; }, 811 | onMoveShouldSetPanResponder: function (evt, gestureState) { return _this.panCapture; }, 812 | onMoveShouldSetPanResponderCapture: function (evt, gestureState) { return _this.panCapture; }, 813 | onShouldBlockNativeResponder: function (evt, gestureState) { return false; }, 814 | onPanResponderTerminationRequest: function (evt, gestureState) { return false; }, 815 | onPanResponderGrant: this.onActiveBlockIsSet(this.onStartDrag), 816 | onPanResponderMove: this.onActiveBlockIsSet(this.onMoveBlock), 817 | onPanResponderRelease: this.onActiveBlockIsSet(this.onReleaseBlock) 818 | }); 819 | }; 820 | return DragDropGrid; 821 | }(React.Component)); 822 | exports.DragDropGrid = DragDropGrid; 823 | var styles = react_native_1.StyleSheet.create({ 824 | sortableGrid: { 825 | flexDirection: 'row', 826 | flexWrap: 'wrap', 827 | flex: 1 828 | }, 829 | deletedBlock: { 830 | opacity: 0, 831 | position: 'absolute', 832 | left: 0, 833 | top: 0, 834 | height: 0, 835 | width: 0 836 | }, 837 | itemImageContainer: { 838 | flex: 1, 839 | justifyContent: 'center' 840 | } 841 | }); 842 | // export default DragDropGrid; 843 | // export const Greeter = (name: string) => `Hello ${name}`; 844 | //# sourceMappingURL=dragDropGrid.js.map -------------------------------------------------------------------------------- /drag-drop-lib/built/dragDropGrid.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"dragDropGrid.js","sourceRoot":"","sources":["../dragDropGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,6CAA+E;AAE/E,gDAA0B;AAC1B,kDAAuB;AAEvB,iCAAkC;AAElC,+BAA+B;AAE/B,iBAAiB;AACjB,IAAM,aAAa,GAAG,CAAC,CAAC;AACxB,IAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,eAAe;AACtD,IAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,eAAe;AACtD,IAAM,+BAA+B,GAAG,GAAG,CAAC,CAAC,eAAe;AAC5D,IAAM,oBAAoB,GAAG,GAAG,CAAC,CAAC,eAAe;AACjD,IAAM,OAAO,GAAG,cAAO,CAAC,CAAC;AAqCzB;IAAkC,gCAA6B;IA8B7D,sBAAY,KAAK;QAAjB,YACE,kBAAM,KAAK,CAAC,SAsDb;QA6BA,kBAAY,GAAG,UAAA,GAAG;YACjB,IAAI,KAAI,CAAC,SAAS;gBAAE,KAAI,CAAC,mBAAmB,EAAE,CAAC;QACjD,CAAC,CAAC;QACD,sBAAgB,GAAG;YAClB,IAAI,YAAY,GAAG,CAAC,KAAI,CAAC,KAAK,CAAC,YAAY,CAAC;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B;AAC/B,6DAA6D"} -------------------------------------------------------------------------------- /drag-drop-lib/built/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var dragDropGrid_1 = require("./dragDropGrid"); 4 | exports.DragDropGrid = dragDropGrid_1.DragDropGrid; 5 | exports.default = { DragDropGrid: dragDropGrid_1.DragDropGrid }; 6 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /drag-drop-lib/built/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAExC,uBAFI,2BAAY,CAEJ;AAEhB,kBAAe,EAAE,YAAY,6BAAA,EAAE,CAAC"} -------------------------------------------------------------------------------- /drag-drop-lib/built/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | module.exports = { 3 | entry: './src/index.js', 4 | output: { 5 | path: path.resolve(__dirname, 'build'), 6 | filename: 'index.js', 7 | libraryTarget: 'commonjs2' 8 | }, 9 | module: { 10 | rules: [ 11 | { 12 | test: /\.js$/, 13 | include: path.resolve(__dirname, 'src'), 14 | exclude: /(node_modules|bower_components|build)/, 15 | use: { 16 | loader: 'babel-loader', 17 | options: { 18 | presets: ['env'] 19 | } 20 | } 21 | } 22 | ] 23 | }, 24 | externals: { 25 | 'react': 'commonjs react' 26 | } 27 | }; 28 | //# sourceMappingURL=webpack.config.js.map -------------------------------------------------------------------------------- /drag-drop-lib/built/webpack.config.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"webpack.config.js","sourceRoot":"","sources":["../webpack.config.js"],"names":[],"mappings":"AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,MAAM,CAAC,OAAO,GAAG;IACf,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE;QACN,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC;QACtC,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,WAAW;KAC3B;IACD,MAAM,EAAE;QACN,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;gBACvC,OAAO,EAAE,uCAAuC;gBAChD,GAAG,EAAE;oBACH,MAAM,EAAE,cAAc;oBACtB,OAAO,EAAE;wBACP,OAAO,EAAE,CAAC,KAAK,CAAC;qBACjB;iBACF;aACF;SACF;KACF;IACD,SAAS,EAAE;QACT,OAAO,EAAE,gBAAgB;KAC1B;CACF,CAAC"} -------------------------------------------------------------------------------- /drag-drop-lib/dragDropGrid.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { StyleSheet, Animated, PanResponder,I18nManager, Image, View } from 'react-native'; 3 | 4 | import Tile from './Tile'; 5 | import _ from 'lodash'; 6 | 7 | import { throttle } from 'lodash'; 8 | 9 | // import block from './block'; 10 | 11 | // Default values 12 | const ITEMS_PER_ROW = 4; 13 | const DRAG_ACTIVATION_THRESHOLD = 200; // Milliseconds 14 | const BLOCK_TRANSITION_DURATION = 300; // Milliseconds 15 | const ACTIVE_BLOCK_CENTERING_DURATION = 200; // Milliseconds 16 | const DOUBLE_TAP_THRESHOLD = 150; // Milliseconds 17 | const NULL_FN = () => {}; 18 | 19 | interface props { 20 | blockTransitionDuration?: any; 21 | activeBlockCenteringDuration?: any; 22 | itemsPerRow?: any; 23 | items?: any; 24 | doubleTapTreshold ? : any; 25 | dragActivationTreshold?: any; 26 | doubleTapThreshold?: any; 27 | onDragRelease?: any; 28 | onDragStart?: any; 29 | onDeleteItem?: any; 30 | dragStartAnimation?: any; 31 | itemWidth?: any; 32 | itemHeight?: any; 33 | style?: any; 34 | onMerge?:any 35 | merge?: any; 36 | } 37 | 38 | interface state{ 39 | gridLayout: any, 40 | random: any, 41 | startDragWiggle: any, 42 | activeBlock: any, 43 | mergeBlock: number, 44 | blockWidth: any, 45 | blockHeight: any, 46 | gridHeight: any, 47 | deleteModeOn: boolean, 48 | deletionSwipePercent: number, 49 | deleteBlock: any, 50 | deleteBlockOpacity: any, 51 | deletedItems: Array 52 | } 53 | 54 | export class DragDropGrid extends React.Component { 55 | rows: any; 56 | dragPosition: any; 57 | activeBlockOffset: any; 58 | blockWidth: any; 59 | blockHeight: any; 60 | gridHeightTarget: any; 61 | ghostBlocks: Array; 62 | itemOrder: any; 63 | orderItem: Array; 64 | merge: boolean; 65 | panCapture: boolean; 66 | items: any; 67 | initialLayoutDone: boolean; 68 | initialDragDone: boolean; 69 | config: any; 70 | tapTimer: any; 71 | tapIgnore: boolean; 72 | doubleTapWait: boolean; 73 | itemsPerRow: any; 74 | _panResponder: any; 75 | dragActivationThreshold: number; 76 | dragStartAnimation: any; 77 | blockPositionsSetCount: number; 78 | key: any; 79 | showAddNew?: boolean; 80 | release: boolean; 81 | doubleTapTreshold:number; 82 | 83 | blockPositions: Array; 84 | constructor(props) { 85 | super(props); 86 | this.state = { 87 | gridLayout: null, 88 | random: null, 89 | startDragWiggle: new Animated.Value(0), 90 | activeBlock: null, 91 | mergeBlock: null, 92 | blockWidth: null, 93 | blockHeight: null, 94 | gridHeight: new Animated.Value(0), 95 | deleteModeOn: false, 96 | deletionSwipePercent: 0, 97 | deleteBlock: null, 98 | deleteBlockOpacity: new Animated.Value(1), 99 | deletedItems: [] 100 | }; 101 | this.itemsPerRow = this.props.itemsPerRow; 102 | this.dragActivationThreshold = this.props.dragActivationTreshold; 103 | this.dragStartAnimation = this.props.dragStartAnimation; 104 | this.doubleTapTreshold = DOUBLE_TAP_THRESHOLD 105 | this._panResponder = null; 106 | this.rows = null; 107 | this.dragPosition = null; 108 | this.activeBlockOffset = null; 109 | this.blockWidth = null; 110 | this.blockPositionsSetCount = 0; 111 | this.blockHeight = null; 112 | this.blockPositions = []; 113 | this.toggleDeleteMode= this.toggleDeleteMode.bind(this); 114 | this.gridHeightTarget = null; 115 | this.ghostBlocks = []; 116 | this.itemOrder = []; 117 | this.showAddNew = false; 118 | this.orderItem = []; 119 | this.merge = false; 120 | this.panCapture = false; 121 | this.items = []; 122 | this.initialLayoutDone = false; 123 | this.initialDragDone = false; 124 | this.config = { tension: 40, friction: 3 }; 125 | this.tapTimer = null; 126 | this.tapIgnore = false; 127 | this.doubleTapWait = false; 128 | this.assessGridSize = this.assessGridSize.bind(this); 129 | this.release = false; 130 | this.key = null; 131 | this._getGridStyle = this._getGridStyle.bind(this); 132 | this._getBlockStyle = this._getBlockStyle.bind(this); 133 | this.saveBlockPositions = this.saveBlockPositions.bind(this); 134 | this.activateDrag = this.activateDrag.bind(this); 135 | this.handleTap = this.handleTap.bind(this); 136 | this.onBlockPress = this.onBlockPress.bind(this); 137 | this._getItemWrapperStyle = this._getItemWrapperStyle.bind(this); 138 | this.deleteBlockList = this.deleteBlockList.bind(this); 139 | } 140 | render() { 141 | return ( 142 | 147 | {this.state.gridLayout && 148 | this.blockPositions && 149 | this.items.map((item, key) => ( 150 | 161 | {item} 162 | 163 | ))} 164 | 165 | ); 166 | } 167 | 168 | onBlockPress = key => { 169 | if (this.tapIgnore) this._resetTapIgnoreTime(); 170 | }; 171 | toggleDeleteMode = () => { 172 | let deleteModeOn = !this.state.deleteModeOn; 173 | this.setState({ deleteModeOn }); 174 | return { deleteModeOn }; 175 | }; 176 | 177 | componentDidMount() { 178 | this.createTouchHandlers(); 179 | this.handleNewProps(this.props); 180 | } 181 | 182 | componentWillUnmount() { 183 | if (this.tapTimer) clearTimeout(this.tapTimer); 184 | } 185 | 186 | componentDidUpdate(prevProps) { 187 | if(prevProps != this.props){ 188 | this.handleNewProps(this.props); 189 | } 190 | } 191 | 192 | handleNewPropsWithoutDelete = properties => { 193 | this.itemsPerRow = this.props.itemsPerRow; 194 | this.dragActivationThreshold = this.props.dragActivationTreshold; 195 | this.dragStartAnimation = this.props.dragStartAnimation; 196 | this._assignReceivedPropertiesIntoThis(properties); 197 | this._saveItemOrder(properties.children); 198 | }; 199 | 200 | handleNewProps = properties => { 201 | this.itemsPerRow = this.props.itemsPerRow; 202 | this.dragActivationThreshold = this.props.dragActivationTreshold; 203 | this.dragStartAnimation = this.props.dragStartAnimation; 204 | this._assignReceivedPropertiesIntoThis(properties); 205 | this._saveItemOrder(properties.children); 206 | this._removeDisappearedChildren(properties.children); 207 | 208 | }; 209 | 210 | onStartDrag = (evt, gestureState) => { 211 | if (this.state.activeBlock != null) { 212 | let activeBlockPosition = this._getActiveBlock().origin; 213 | let x = activeBlockPosition.x - gestureState.x0; 214 | let y = activeBlockPosition.y - gestureState.y0; 215 | this.activeBlockOffset = { x, y }; 216 | this.initialDragDone = true 217 | this._getActiveBlock().currentPosition.setOffset({ x, y }); 218 | this._getActiveBlock().currentPosition.setValue({ 219 | x: gestureState.moveX, 220 | y: gestureState.moveY 221 | }); 222 | } 223 | }; 224 | 225 | onMoveBlock = (evt, { moveX, moveY, dx, dy }) => { 226 | if (this.state.activeBlock != null && this._blockPositionsSet()) { 227 | if (this.state.deleteModeOn) return this.deleteModeMove({ x: moveX, y: moveY }); 228 | if (dx != 0 || dy != 0) this.initialDragDone = true; 229 | let yChokeAmount = Math.max( 230 | 0, 231 | this.activeBlockOffset.y + moveY - (this.state.gridLayout.height - this.blockHeight) 232 | ); 233 | let xChokeAmount = Math.max( 234 | 0, 235 | this.activeBlockOffset.x + moveX - (this.state.gridLayout.width - this.blockWidth) 236 | ); 237 | let yMinChokeAmount = Math.min(0, this.activeBlockOffset.y + moveY); 238 | let xMinChokeAmount = Math.min(0, this.activeBlockOffset.x + moveX); 239 | 240 | let dragPosition = { 241 | x: moveX - xChokeAmount - xMinChokeAmount, 242 | y: moveY - yChokeAmount - yMinChokeAmount 243 | }; 244 | this.dragPosition = dragPosition; 245 | this._getActiveBlock().currentPosition.setValue(dragPosition); 246 | if (dx != 0 || dy != 0) this.initialDragDone = true 247 | this.moveAnim( 248 | this.state.activeBlock, 249 | this.blockPositions, 250 | this.itemOrder, 251 | this.state.mergeBlock 252 | ); 253 | } 254 | }; 255 | 256 | moveAnim = throttle((activeBlock, bp, itemOrder, mergeBlock) => { 257 | if (!this.release) { 258 | let closest = activeBlock; 259 | let originalPosition = this._getActiveBlock().origin; 260 | let distanceToOrigin = this._getDistanceTo(originalPosition); 261 | let closestDistance = distanceToOrigin; 262 | let merge = false; 263 | this.blockPositions && 264 | this.blockPositions.forEach((block, index) => { 265 | if (index !== activeBlock && block.origin) { 266 | let blockPosition = block.origin; 267 | let distance = this._getDistanceTo(blockPosition); 268 | 269 | //condition to avoid "+" block 270 | 271 | //condition to check whether block has come close to any other block 272 | if (distance < closestDistance && distance < this.state.blockWidth) { 273 | closest = index; 274 | closestDistance = distance; 275 | //this is the condition for group creation(mergeblock) 276 | if (this.props.merge) { 277 | if (distance < this.state.blockWidth / 3) { 278 | var arr1 = []; 279 | if (closest != mergeBlock) { 280 | //if already an mergeblock exist get it to actual size 281 | 282 | if (mergeBlock != null) { 283 | Animated.spring(bp[mergeBlock].pop, { 284 | toValue: 0, 285 | tension: 40, 286 | friction: 3 287 | }).start(); 288 | } 289 | 290 | arr1.push( 291 | Animated.spring(bp[activeBlock].hoverPop, { 292 | toValue: -1, 293 | tension: 40, 294 | friction: 3 295 | }) 296 | ); 297 | arr1.push( 298 | Animated.spring(bp[closest].pop, { 299 | toValue: -1, 300 | tension: 40, 301 | friction: 3 302 | }) 303 | ); 304 | Animated.parallel(arr1).start(); 305 | } 306 | merge = true; 307 | } 308 | } 309 | } 310 | } 311 | }); 312 | 313 | this.merge = merge; 314 | if (!merge) { 315 | var arr = []; 316 | //if there no mergegroup gesture the reposition already existing mergeblock 317 | //create empty blocks (for remaing space) 318 | this.ghostBlocks && 319 | this.ghostBlocks.forEach(ghostBlockPosition => { 320 | let distance = this._getDistanceTo(ghostBlockPosition); 321 | if (distance < closestDistance) { 322 | closest = activeBlock; 323 | closestDistance = distance; 324 | } 325 | }); 326 | 327 | //this is for reposition animation 328 | if (closest !== activeBlock) { 329 | var date = new Date(); 330 | var timestamp = date.getTime(); 331 | const increment = 332 | this.itemOrder[closest].order < this.itemOrder[activeBlock].order ? -1 : 1; 333 | var arr = []; 334 | var toPos, pos; 335 | var closetOrder = this.itemOrder[closest].order; 336 | var activeOrder = this.itemOrder[activeBlock].order; 337 | let blockPositions = bp; 338 | 339 | //repostion animation for the blocks which are supposed to be repositioned (zig zag animation) 340 | for (let k = activeOrder; k != closetOrder; k += increment) { 341 | itemOrder && 342 | itemOrder.forEach((item, index) => { 343 | if (item.order == k) { 344 | toPos = index; 345 | } 346 | if (item.order == k + increment) { 347 | pos = index; 348 | } 349 | }); 350 | 351 | arr.push( 352 | Animated.timing(bp[pos].currentPosition, { 353 | toValue: bp[toPos].origin, 354 | duration: this.props.blockTransitionDuration 355 | }) 356 | ); 357 | } 358 | 359 | if (mergeBlock != null) { 360 | arr.push( 361 | Animated.spring(bp[mergeBlock].pop, { 362 | toValue: 0, 363 | tension: 40, 364 | friction: 3 365 | }) 366 | ); 367 | arr.push( 368 | Animated.spring(bp[activeBlock].hoverPop, { 369 | toValue: 1, 370 | tension: 40, 371 | friction: 3 372 | }) 373 | ); 374 | } 375 | 376 | //this part repositions all the blocks saves their respected positions and offesets 377 | var dup_array = this.deepCopy(this.orderItem); 378 | let currPos = blockPositions[closest].origin; 379 | var tempOrderIndex = this.itemOrder[closest].order; 380 | for (let k = closetOrder; k != activeOrder; k -= increment) { 381 | toPos = this.orderItem[k].order; 382 | pos = this.orderItem[k - increment].order; 383 | blockPositions[toPos].origin = blockPositions[pos].origin; 384 | this.itemOrder[toPos].order = this.itemOrder[pos].order; 385 | dup_array[k - increment].order = toPos; 386 | } 387 | blockPositions[activeBlock].origin = currPos; 388 | dup_array[closetOrder].order = activeBlock; 389 | this.orderItem = dup_array; 390 | this.itemOrder[activeBlock].order = tempOrderIndex; 391 | this.blockPositions = blockPositions; 392 | Animated.parallel(arr).start(); 393 | } 394 | } else if (closest != mergeBlock) { 395 | this.setState({ mergeBlock: closest }); 396 | } 397 | } 398 | }, 400); 399 | 400 | onReleaseBlock = (evt, gestureState) => { 401 | this.release = true; 402 | this.moveAnim.cancel(); 403 | this.returnBlockToOriginalPosition(); 404 | this.afterDragRelease(); 405 | this.merge = false; 406 | }; 407 | 408 | 409 | deleteBlockList = key => { 410 | this.key = key; 411 | const activeKey = _.findKey(this.itemOrder, oldItem => oldItem.key == key); 412 | let activeBlock = activeKey; 413 | this.deleteBlocks([activeBlock]); 414 | this.afterDragRelease(); 415 | }; 416 | 417 | blockAnimateFadeOut = () => { 418 | this.state.deleteBlockOpacity.setValue(1); 419 | return new Promise((resolve, reject) => { 420 | Animated.timing(this.state.deleteBlockOpacity, { 421 | toValue: 0, 422 | duration: 2 * this.props.activeBlockCenteringDuration 423 | }).start(resolve); 424 | }); 425 | }; 426 | 427 | animateBlockMove = (blockIndex, position) => { 428 | return Animated.timing(this._getBlock(blockIndex).currentPosition, { 429 | toValue: position, 430 | duration: this.props.blockTransitionDuration 431 | }); 432 | }; 433 | 434 | returnBlockToOriginalPosition = () => { 435 | this.repositionMergeBlockAndUpdate(); 436 | if (this.state.mergeBlock != null) { 437 | Animated.spring(this.blockPositions[this.state.mergeBlock].pop, { 438 | toValue: 0, 439 | tension: 40, 440 | friction: 3 441 | }).start(); 442 | } 443 | this.repostionBlocks(); 444 | this.repositionActiveBlock(); 445 | this.merge = false; 446 | }; 447 | 448 | repostionBlocks() { 449 | var arr = []; 450 | let bp = this.blockPositions; 451 | for (let i = 0; i < bp.length; i++) { 452 | Animated.timing(bp[i].currentPosition, { 453 | toValue: bp[i].origin, 454 | duration: this.props.activeBlockCenteringDuration 455 | }).start(); 456 | } 457 | } 458 | repositionMergeBlockAndUpdate() { 459 | if (this.props.merge) { 460 | let closest = this.state.activeBlock; 461 | let originalPosition = this._getActiveBlock().origin; 462 | let distanceToOrigin = this._getDistanceTo(originalPosition); 463 | let closestDistance = distanceToOrigin; 464 | let bp = this.blockPositions; 465 | let mergeBlock = this.state.mergeBlock; 466 | let activeBlock = this.state.activeBlock; 467 | if (mergeBlock != null) { 468 | let blockPosition = this._getBlock(mergeBlock).origin; 469 | let distance = this._getDistanceTo(blockPosition); 470 | if (distance < closestDistance && distance < this.state.blockWidth / 4) { 471 | this.props.onMerge(this.items[activeBlock].key, this.items[mergeBlock].key); 472 | } 473 | Animated.spring(bp[mergeBlock].pop, { 474 | toValue: 0, 475 | tension: 40, 476 | friction: 3 477 | }).start(); 478 | } 479 | } 480 | } 481 | repositionActiveBlock() { 482 | let activeBlockCurrentPosition = this._getActiveBlock().currentPosition; 483 | activeBlockCurrentPosition.flattenOffset(); 484 | let toValueAnim = this._getActiveBlock().origin; 485 | let hoverPopOfItem = this._getActiveBlock().hoverPop; 486 | hoverPopOfItem.stopAnimation(); 487 | Animated.timing(activeBlockCurrentPosition, { 488 | toValue: toValueAnim, 489 | duration: this.props.activeBlockCenteringDuration 490 | }).start(); 491 | Animated.spring(hoverPopOfItem, { 492 | toValue: 0, 493 | tension: 40, 494 | friction: 3 495 | }).start(); 496 | } 497 | afterDragRelease = () => { 498 | let itemOrder = _.sortBy(this.itemOrder, item => item.order); 499 | let orderItem = _.sortBy(this.orderItem, item => item.order); 500 | this.props.onDragRelease && this.props.onDragRelease({ itemOrder }); 501 | this.setState({ activeBlock: null }); 502 | this.setState({ mergeBlock: null }); 503 | this.panCapture = false; 504 | }; 505 | 506 | deleteModeMove = ({ x, y }) => { 507 | let slideDistance = 50; 508 | let moveY = y + this.activeBlockOffset.y - this._getActiveBlock().origin.y; 509 | let adjustY = 0; 510 | if (moveY < 0) adjustY = moveY; 511 | else if (moveY > slideDistance) adjustY = moveY - slideDistance; 512 | let deletionSwipePercent = ((moveY - adjustY) / slideDistance) * 100; 513 | this._getActiveBlock().currentPosition.y.setValue(y - adjustY); 514 | this.setState({ deletionSwipePercent }); 515 | }; 516 | 517 | assessGridSize({ nativeEvent }) { 518 | if (this.props.itemWidth < nativeEvent.layout.width) { 519 | this.itemsPerRow = Math.floor(nativeEvent.layout.width / this.props.itemWidth); 520 | this.blockWidth = nativeEvent.layout.width / this.itemsPerRow; 521 | this.blockHeight = this.props.itemHeight || this.blockWidth; 522 | } else { 523 | this.blockWidth = nativeEvent.layout.width / this.itemsPerRow; 524 | this.blockHeight = this.blockWidth; 525 | } 526 | if (this.state.gridLayout != nativeEvent.layout) { 527 | this.setState({ 528 | gridLayout: nativeEvent.layout, 529 | blockWidth: this.blockWidth, 530 | blockHeight: this.blockHeight 531 | }); 532 | } 533 | } 534 | 535 | deepCopy(arr) { 536 | var out = []; 537 | for (var i = 0, len = arr.length; i < len; i++) { 538 | var item = arr[i]; 539 | var obj = {}; 540 | for (var k in item) { 541 | obj[k] = item[k]; 542 | } 543 | out.push(obj); 544 | } 545 | return out; 546 | } 547 | 548 | reAssessGridRows = () => { 549 | let oldRows = this.rows; 550 | this.rows = Math.ceil(this.items.length / this.itemsPerRow); 551 | if (this.state.blockWidth && oldRows != this.rows) this._animateGridHeight(); 552 | }; 553 | 554 | saveBlockPositions = key => ({ nativeEvent }) => { 555 | let blockPositions = this.blockPositions; 556 | if (!blockPositions[key]) { 557 | let blockPositionsSetCount = blockPositions[key] 558 | ? this.blockPositionsSetCount 559 | : ++this.blockPositionsSetCount; 560 | let thisPosition = { 561 | x: nativeEvent.layout.x, 562 | y: nativeEvent.layout.y 563 | }; 564 | blockPositions[key] = { 565 | currentPosition: new Animated.ValueXY(thisPosition), 566 | origin: thisPosition, 567 | pop: new Animated.Value(0), 568 | hoverPop: new Animated.Value(0) 569 | }; 570 | if (this._blockPositionsSet()) { 571 | this.blockPositions = blockPositions; 572 | this.setGhostPositions(); 573 | this.initialLayoutDone = true; 574 | } 575 | } 576 | }; 577 | 578 | getNextBlockCoordinates = () => { 579 | let blockWidth = this.state.blockWidth; 580 | let blockHeight = this.state.blockHeight; 581 | let placeOnRow = this.items.length % this.itemsPerRow; 582 | let y = blockHeight * Math.floor(this.items.length / this.itemsPerRow) + 20; 583 | let x = placeOnRow * blockWidth; 584 | return { x, y }; 585 | }; 586 | 587 | setGhostPositions = () => { 588 | this.ghostBlocks = []; 589 | this.reAssessGridRows(); 590 | let blockWidth = this.state.blockWidth; 591 | let blockHeight = this.state.blockHeight; 592 | let fullGridItemCount = this.rows * this.itemsPerRow; 593 | let ghostBlockCount = fullGridItemCount - this.items.length; 594 | let y = blockHeight * (this.rows - 1); 595 | let initialX = blockWidth * (this.itemsPerRow - ghostBlockCount); 596 | for (let i = 0; i < ghostBlockCount; ++i) { 597 | let x = initialX + blockWidth * i; 598 | this.ghostBlocks.push({ x, y }); 599 | } 600 | }; 601 | 602 | activateDrag = key => () => { 603 | this.release = false; 604 | this.props.onDragStart(key); 605 | let favKey = this.items[key].key; 606 | this.panCapture = true 607 | this.setState({ activeBlock: key }) 608 | this._defaultDragActivationWiggle(); 609 | }; 610 | 611 | 612 | handleTap = ({ onTap = NULL_FN, onDoubleTap = NULL_FN },key) => () => { 613 | if (this.tapIgnore) this._resetTapIgnoreTime() 614 | else if (onDoubleTap != null) { 615 | this.doubleTapWait ? this._onDoubleTap(onDoubleTap) : this._onSingleTap(onTap) 616 | } else onTap() 617 | } 618 | 619 | // Helpers & other boring stuff 620 | _getActiveBlock = () => this.blockPositions[this.state.activeBlock]; 621 | 622 | _getBlock = blockIndex => this.blockPositions[blockIndex]; 623 | 624 | _blockPositionsSet = () => this.blockPositionsSetCount == this.items.length; 625 | 626 | //when the items added or deleted from the backend we maitain it 627 | _saveItemOrder = items => { 628 | items && 629 | items.forEach((item, index) => { 630 | const foundKey = _.findKey(this.itemOrder, oldItem => oldItem.key == item.key); 631 | if (foundKey) { 632 | this.items[foundKey] = item; 633 | } else { 634 | this.itemOrder.push({ key: item.key, ref: item.ref, order: this.items.length }); 635 | this.orderItem.push({ 636 | key: item.key, 637 | ref: item.ref, 638 | order: this.items.length, 639 | originKey: this.items.length 640 | }); 641 | if (!this.initialLayoutDone) { 642 | this.items.push(item); 643 | } else { 644 | let blockPositionsSetCount = ++this.blockPositionsSetCount; 645 | let thisPosition = this.getNextBlockCoordinates(); 646 | 647 | this.blockPositions.push({ 648 | currentPosition: new Animated.ValueXY(thisPosition), 649 | origin: thisPosition, 650 | pop: new Animated.Value(0), 651 | hoverPop: new Animated.Value(0) 652 | }); 653 | this.items.push(item); 654 | this.setGhostPositions(); 655 | } 656 | } 657 | }); 658 | }; 659 | 660 | deleteDisapearedItems(items) { 661 | let deleteBlockIndices = []; 662 | let blockPositions = this.blockPositions; 663 | let blockPositionsSetCount = this.blockPositionsSetCount; 664 | this.itemOrder && 665 | _.cloneDeep(this.itemOrder).forEach((item, index) => { 666 | if (!_.findKey(items, oldItem => oldItem.key == item.key)) { 667 | deleteBlockIndices.push(index); 668 | } 669 | }); 670 | if (deleteBlockIndices.length > 0) { 671 | deleteBlockIndices && 672 | _.sortBy(deleteBlockIndices, index => -index).forEach(index => { 673 | --blockPositionsSetCount; 674 | let order = this.itemOrder[index].order; 675 | blockPositions.splice(index, 1); 676 | let indexOrder = this.findIndex(this.orderItem, index); 677 | this._fixItemOrderOnDeletion(this.itemOrder[index]); 678 | this.orderItem.splice(indexOrder, 1); 679 | this.itemOrder.splice(index, 1); 680 | this._fixOrderItemOnDeletion(this.itemOrder); 681 | 682 | this.items.splice(index, 1); 683 | }); 684 | 685 | this.blockPositionsSetCount = blockPositionsSetCount; 686 | return blockPositions; 687 | } 688 | } 689 | 690 | isNotEqual(items, currentItems) { 691 | for (let i = 0; i < items.length; i++) { 692 | if (items[i].key != currentItems[i].key) { 693 | return true; 694 | } 695 | } 696 | return false; 697 | } 698 | 699 | unloadLastTile() { 700 | if (this.blockPositions.length > 0) { 701 | this.itemOrder.splice(this.itemOrder.length - 1, 1); 702 | this.orderItem.splice(this.orderItem.length - 1, 1); 703 | this.items.splice(this.items.length - 1, 1); 704 | this.blockPositions.splice(this.blockPositions.length - 1, 1); 705 | this.blockPositionsSetCount = this.blockPositionsSetCount - 1; 706 | } 707 | } 708 | 709 | _removeDisappearedChildren = items => { 710 | let deleteBlockIndices = []; 711 | this.itemOrder && 712 | _.cloneDeep(this.itemOrder).forEach((item, index) => { 713 | if (!_.findKey(items, oldItem => oldItem.key == item.key)) { 714 | deleteBlockIndices.push(index); 715 | } 716 | }); 717 | if (deleteBlockIndices.length > 0) { 718 | this.deleteBlocks(deleteBlockIndices); 719 | } 720 | }; 721 | 722 | deleteBlocks = deleteBlockIndices => { 723 | let blockPositionsSetCount = this.blockPositionsSetCount; 724 | _.sortBy(deleteBlockIndices, index => -index).forEach(index => { 725 | --blockPositionsSetCount; 726 | let order = this.itemOrder[index].order; 727 | this.blockPositions.splice(index, 1); 728 | let indexOrder = this.findIndex(this.orderItem, index); 729 | this._fixItemOrderOnDeletion(this.itemOrder[index]); 730 | this.orderItem.splice(indexOrder, 1); 731 | this.itemOrder.splice(index, 1); 732 | this._fixOrderItemOnDeletion(this.itemOrder); 733 | this.items.splice(index, 1); 734 | }); 735 | 736 | var arr = []; 737 | this.blockPositionsSetCount = blockPositionsSetCount; 738 | this.items && 739 | this.items.forEach((item, order) => { 740 | let blockIndex = _.findKey(this.itemOrder, item => item.order == order); 741 | let x = (order * this.state.blockWidth) % (this.itemsPerRow * this.state.blockWidth); 742 | let y = Math.floor(order / this.itemsPerRow) * this.state.blockHeight + 20; 743 | this.blockPositions[blockIndex].origin = { x, y }; 744 | if (this.key == null) { 745 | this.blockPositions[blockIndex].currentPosition = new Animated.ValueXY({ x, y }); 746 | } else arr.push(this.animateBlockMove(blockIndex, { x, y })); 747 | }); 748 | if (arr.length > 0) { 749 | Animated.parallel(arr).start(() => { 750 | if (this.key != null) this.props.onDeleteItem(this.key); 751 | this.key = null; 752 | this.setGhostPositions(); 753 | }); 754 | } else { 755 | this.setGhostPositions(); 756 | } 757 | }; 758 | 759 | findIndex(orderItem, key) { 760 | for (let i = 0; i < orderItem.length; i++) { 761 | if (orderItem[i].order == key) { 762 | return i; 763 | } 764 | } 765 | return -1; 766 | } 767 | 768 | _fixItemOrderOnDeletion = orderItem => { 769 | if (!orderItem) return false; 770 | orderItem.order--; 771 | this._fixItemOrderOnDeletion(_.find(this.itemOrder, item => item.order == orderItem.order + 2)); 772 | }; 773 | 774 | _fixOrderItemOnDeletion = itemOrder => { 775 | let orderItem = this.orderItem; 776 | for (let i = 0; i < itemOrder.length; i++) { 777 | orderItem[itemOrder[i].order].order = i; 778 | } 779 | this.orderItem = orderItem; 780 | }; 781 | 782 | _animateGridHeight = () => { 783 | this.gridHeightTarget = this.rows * this.state.blockHeight; 784 | if (this.gridHeightTarget == this.state.gridLayout.height || this.state.gridLayout.height == 0) 785 | this.state.gridHeight.setValue(this.gridHeightTarget); 786 | else if (this.state.gridHeight._value !== this.gridHeightTarget) { 787 | Animated.timing(this.state.gridHeight, { 788 | toValue: this.gridHeightTarget, 789 | duration: this.props.blockTransitionDuration 790 | }).start(); 791 | } 792 | }; 793 | 794 | _getDistanceTo = point => { 795 | let xDistance = this.dragPosition.x + this.activeBlockOffset.x - point.x; 796 | let yDistance = this.dragPosition.y + this.activeBlockOffset.y - point.y; 797 | return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2)); 798 | }; 799 | 800 | _defaultDragActivationWiggle = () => { 801 | if (!this.props.dragStartAnimation) { 802 | let activeBlock = this._getActiveBlock(); 803 | Animated.spring(activeBlock.hoverPop, { 804 | toValue: 1, 805 | friction: 3, 806 | tension: 40 807 | }).start(() => {}); 808 | } 809 | }; 810 | 811 | _blockActivationWiggle = key => { 812 | return ( 813 | this.props.dragStartAnimation || { 814 | transform: [ 815 | { 816 | scale: this._getBlock(key).hoverPop.interpolate({ 817 | inputRange: [-1, 0, 1], 818 | outputRange: [0.8, 1, 1.3] 819 | }) 820 | } 821 | ] 822 | } 823 | ); 824 | }; 825 | 826 | _assignReceivedPropertiesIntoThis(properties) { 827 | properties && 828 | Object.keys(properties).forEach(property => { 829 | if (this[property]) this[property] = properties[property]; 830 | }); 831 | this.dragStartAnimation = properties.dragStartAnimation; 832 | } 833 | 834 | 835 | _onSingleTap = (onTap) => { 836 | this.doubleTapWait = true 837 | this.tapTimer = setTimeout( () => { 838 | this.doubleTapWait = false 839 | onTap() 840 | }, this.doubleTapTreshold) 841 | } 842 | 843 | _onDoubleTap = onDoubleTap => { 844 | this._resetTapIgnoreTime(); 845 | this.doubleTapWait = false; 846 | this.tapIgnore = true; 847 | onDoubleTap(); 848 | }; 849 | 850 | _resetTapIgnoreTime = () => { 851 | clearTimeout(this.tapTimer); 852 | this.tapTimer = setTimeout(() => (this.tapIgnore = false), this.props.doubleTapThreshold); 853 | }; 854 | 855 | createTouchHandlers() { 856 | this._panResponder = PanResponder.create({ 857 | onPanResponderTerminate: (evt, gestureState) => {}, 858 | onStartShouldSetPanResponder: (evt, gestureState) => true, 859 | onStartShouldSetPanResponderCapture: (evt, gestureState) => false, 860 | onMoveShouldSetPanResponder: (evt, gestureState) => this.panCapture, 861 | onMoveShouldSetPanResponderCapture: (evt, gestureState) => this.panCapture, 862 | onShouldBlockNativeResponder: (evt, gestureState) => false, 863 | onPanResponderTerminationRequest: (evt, gestureState) => false, 864 | onPanResponderGrant: this.onActiveBlockIsSet(this.onStartDrag), 865 | onPanResponderMove: this.onActiveBlockIsSet(this.onMoveBlock), 866 | onPanResponderRelease: this.onActiveBlockIsSet(this.onReleaseBlock) 867 | }); 868 | } 869 | 870 | onActiveBlockIsSet = fn => (evt, gestureState) => { 871 | if (this.state.activeBlock != null) fn(evt, gestureState); 872 | }; 873 | 874 | _getImageDeleteIconStyle = key => [ 875 | { 876 | position: 'absolute', 877 | top: this.state.blockHeight/2 - 15, 878 | left: this.state.blockWidth/2 - 15, 879 | width: 30, 880 | height: 30, 881 | opacity: .5 882 | }, 883 | this.state.activeBlock == key 884 | && this._getBlock( key ).origin && 885 | { opacity: .5 + this._getDynamicOpacity(key) } 886 | ]; 887 | _getGridStyle = () => [ 888 | styles.sortableGrid, 889 | this.props.style, 890 | this._blockPositionsSet() && { height: this.state.gridHeight } 891 | ]; 892 | 893 | _getItemWrapperStyle = key => [ 894 | { flex: 1 }, 895 | this.state.activeBlock == key && 896 | this.state.deleteModeOn && 897 | this._getBlock(key).origin && { opacity: 1.5 - this._getDynamicOpacity(key) } 898 | ]; 899 | 900 | _getDynamicOpacity = key => 901 | (this._getBlock(key).currentPosition.y._value + 902 | this._getBlock(key).currentPosition.y._offset - 903 | this._getBlock(key).origin.y) / 904 | 50; 905 | 906 | _getBlockStyle = key => { 907 | let directionalLayout = {}; 908 | if(this._blockPositionsSet()){ 909 | directionalLayout = I18nManager.isRTL ? 910 | {right: this._getBlock(key).currentPosition.getLayout().left}: 911 | {left: this._getBlock(key).currentPosition.getLayout().left} 912 | } 913 | 914 | return [ 915 | { 916 | width: this.state.blockWidth, 917 | height: this.state.blockHeight, 918 | justifyContent: 'center' 919 | }, 920 | this._blockPositionsSet() && { 921 | position: 'absolute', 922 | top: this._getBlock(key).currentPosition.getLayout().top, 923 | ...directionalLayout, 924 | transform: [ 925 | { 926 | scale: this._getBlock(key).pop.interpolate({ 927 | inputRange: [-1, 0, 1], 928 | outputRange: [0.5, 1, 1] 929 | }) 930 | }, 931 | { 932 | translateY: this._getBlock(key).pop.interpolate({ 933 | inputRange: [-1, 0, 1], 934 | outputRange: [-1 * 50, 0, 0] 935 | }) 936 | } 937 | ] 938 | }, 939 | 940 | this.state.activeBlock == key && this._blockActivationWiggle(key), 941 | this.state.activeBlock == key && { zIndex: 1 }, 942 | this.state.deleteBlock != null && { zIndex: 2 }, 943 | this.state.deleteBlock == key && { opacity: this.state.deleteBlockOpacity }, 944 | 945 | ]; 946 | } 947 | } 948 | 949 | const styles = StyleSheet.create({ 950 | sortableGrid: { 951 | flexDirection: 'row', 952 | flexWrap: 'wrap', 953 | flex:1 954 | }, 955 | deletedBlock: { 956 | opacity: 0, 957 | position: 'absolute', 958 | left: 0, 959 | top: 0, 960 | height: 0, 961 | width: 0 962 | }, 963 | itemImageContainer: { 964 | flex: 1, 965 | justifyContent: 'center' 966 | } 967 | }); 968 | 969 | // export default DragDropGrid; 970 | // export const Greeter = (name: string) => `Hello ${name}`; 971 | -------------------------------------------------------------------------------- /drag-drop-lib/index.ts: -------------------------------------------------------------------------------- 1 | 2 | import {DragDropGrid} from './dragDropGrid'; 3 | export { 4 | DragDropGrid, 5 | }; 6 | export default { DragDropGrid }; 7 | -------------------------------------------------------------------------------- /drag-drop-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-drag-drop-grid-library", 3 | "version": "1.0.4", 4 | "description": "A react-native Drag Drop Grid library works animations are similar to android default launcher app ", 5 | "main": "built/index.js", 6 | "types": "index.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "start": "webpack --watch", 10 | "build": "tsc" 11 | }, 12 | "keywords": [ 13 | "react-native", 14 | "drag", 15 | "drop", 16 | "Grid", 17 | "Sortable", 18 | "Grid" 19 | ], 20 | "author": "Unicorn Coder", 21 | "license": "MIT", 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/unicorncoderforever/DragDropLibrary" 25 | }, 26 | "devDependencies": { 27 | "@types/react": "*", 28 | "@types/react-native": "*", 29 | "react": "*", 30 | "react-native": "^0.59.6", 31 | "typescript": "^3.4.5" 32 | }, 33 | "peerDependencies": { 34 | "lodash": "^4.17.4", 35 | "react": "*", 36 | "react-native": "*" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /drag-drop-lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | // "allowJs": true, 4 | // "target": "es5", 5 | // "module": "commonjs", 6 | // "declaration": true, 7 | // "outDir": "./lib", 8 | // "strict": true, 9 | "allowJs": true, 10 | "allowSyntheticDefaultImports": true, 11 | "esModuleInterop": true, 12 | "noImplicitAny": false, 13 | // "jsx": "react", 14 | // "lib": ["es6"], 15 | "moduleResolution": "node", 16 | // "noEmit": true, 17 | // "target": "esnext", 18 | // "outDir": "built", 19 | // "skipLibCheck": true, 20 | "resolveJsonModule": true, 21 | // "module": "esnext", 22 | // "experimentalDecorators": true, 23 | "preserveConstEnums": true, 24 | // "inlineSourceMap": true, 25 | 26 | // "module": "commonjs", 27 | // "strict": true, 28 | "emitDecoratorMetadata": true, 29 | "experimentalDecorators": true, 30 | "jsx": "react-native", 31 | "lib": ["dom", "es5", "es6", "scripthost"], 32 | // "target": "es5", 33 | "outDir": "built", 34 | // "sourceMap": true, 35 | "skipLibCheck": true, 36 | "module": "commonjs", 37 | // "strict": true, 38 | // "emitDecoratorMetadata": true, 39 | // "experimentalDecorators": true, 40 | // "jsx": "react-native", 41 | // "lib": ["dom", "es5", "es6", "scripthost"], 42 | "target": "es5", 43 | // "outDir": "built", 44 | "sourceMap": true, 45 | // "skipLibCheck": true 46 | 47 | }, 48 | "exclude": ["node_modules", "**/__tests__/*"] 49 | } -------------------------------------------------------------------------------- /drag-drop-lib/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | module.exports = { 3 | entry: './src/index.js', 4 | output: { 5 | path: path.resolve(__dirname, 'build'), 6 | filename: 'index.js', 7 | libraryTarget: 'commonjs2' 8 | }, 9 | module: { 10 | rules: [ 11 | { 12 | test: /\.js$/, 13 | include: path.resolve(__dirname, 'src'), 14 | exclude: /(node_modules|bower_components|build)/, 15 | use: { 16 | loader: 'babel-loader', 17 | options: { 18 | presets: ['env'] 19 | } 20 | } 21 | } 22 | ] 23 | }, 24 | externals: { 25 | 'react': 'commonjs react' 26 | } 27 | }; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /ios/DragDropLibrary-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ios/DragDropLibrary-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/project.xcworkspace/xcuserdata/mitel.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/ios/DragDropLibrary.xcodeproj/project.xcworkspace/xcuserdata/mitel.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/project.xcworkspace/xcuserdata/mitel.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | EnabledFullIndexStoreVisibility 12 | 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/xcshareddata/xcschemes/DragDropLibrary-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/xcshareddata/xcschemes/DragDropLibrary.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ios/DragDropLibrary.xcodeproj/xcuserdata/mitel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DragDropLibrary-tvOS.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | DragDropLibrary.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"DragDropLibrary" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/DragDropLibrary/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | DragDropLibrary 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | NSLocationWhenInUseUsageDescription 44 | 45 | NSAppTransportSecurity 46 | 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | NSExceptionDomains 51 | 52 | localhost 53 | 54 | NSExceptionAllowsInsecureHTTPLoads 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ios/DragDropLibrary/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ios/DragDropLibraryTests/DragDropLibraryTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface DragDropLibraryTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation DragDropLibraryTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ios/DragDropLibraryTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DragDropLibrary", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.8.3", 11 | "react-native": "0.59.8", 12 | "react-native-extra-dimensions-android": "^1.2.5", 13 | "react-native-drag-drop-grid-library": "file:./drag-drop-lib" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "^7.4.4", 17 | "@babel/runtime": "^7.4.4", 18 | "@types/react": "^16.8.17", 19 | "@types/react-native": "^0.57.53", 20 | "babel-jest": "^24.8.0", 21 | "jest": "^24.8.0", 22 | "metro-react-native-babel-preset": "^0.54.0", 23 | "react-native-typescript-transformer": "^1.2.12", 24 | "react-test-renderer": "16.8.3", 25 | "typescript": "^3.4.5" 26 | }, 27 | "jest": { 28 | "preset": "react-native" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rn-cli.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicorncoderforever/DraggableSortableGridLibrary/1c55dbbf0ab04065819b03cea2fe105262826be3/rn-cli.config.js -------------------------------------------------------------------------------- /styles.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Global App Styles 3 | **/ 4 | 'use strict'; 5 | 6 | import { Dimensions, PixelRatio, StyleSheet, Platform } from 'react-native'; 7 | import ExtraDimensions from 'react-native-extra-dimensions-android'; 8 | 9 | // Precalculate Device Dimensions for better performance 10 | 11 | const SOFT_MENU_BAR_HEIGHT = 12 | Platform.OS === 'ios' ? 0 : ExtraDimensions.get('SOFT_MENU_BAR_HEIGHT'); 13 | const STATUS_BAR_HEIGHT = Platform.OS === 'ios' ? 20 : ExtraDimensions.get('STATUS_BAR_HEIGHT'); 14 | const x: number = 15 | Platform.OS === 'ios' ? Dimensions.get('window').width : ExtraDimensions.get('REAL_WINDOW_WIDTH'); 16 | const y: number = 17 | Platform.OS === 'ios' 18 | ? Dimensions.get('window').height 19 | : ExtraDimensions.get('REAL_WINDOW_HEIGHT') - SOFT_MENU_BAR_HEIGHT; 20 | const BASE_WIDTH: number = 375; 21 | const BASE_HEIGHT: number = 667; 22 | 23 | export const Style = { 24 | DEVICE_WIDTH: x, 25 | DEVICE_HEIGHT: y, 26 | getWidth: getWidth, 27 | getHeight: getHeight 28 | } 29 | export function getWidth(value: number): number { 30 | return x * (value / BASE_WIDTH); 31 | } 32 | 33 | export function getHeight(value: number): number { 34 | return Math.round(y * (value / BASE_HEIGHT)); 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "allowSyntheticDefaultImports": true, 5 | "esModuleInterop": true, 6 | "noImplicitAny": false, 7 | // "jsx": "react", 8 | // "lib": ["es6"], 9 | "moduleResolution": "node", 10 | "noEmit": true, 11 | "target": "esnext", 12 | // "outDir": "built", 13 | // "skipLibCheck": true, 14 | "resolveJsonModule": true, 15 | // "module": "esnext", 16 | // "experimentalDecorators": true, 17 | "preserveConstEnums": true, 18 | "inlineSourceMap": true, 19 | 20 | "module": "commonjs", 21 | // "strict": true, 22 | "emitDecoratorMetadata": true, 23 | "experimentalDecorators": true, 24 | "jsx": "react-native", 25 | "lib": ["dom", "es5", "es6", "scripthost"], 26 | // "target": "es5", 27 | "outDir": "built", 28 | // "sourceMap": true, 29 | "skipLibCheck": true 30 | 31 | }, 32 | "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js","example"], 33 | "compileOnSave": false 34 | } 35 | --------------------------------------------------------------------------------