diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 0000000..47a37f9 --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,36 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..6cdebaf --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,33 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/README.md b/README.md index 3fd5d72..9159a80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # react-native-drag-sort Drag and drop sort control for react-native +This is a fork that fixes DragSortableView / AutoDragSortableView's bug, where when you try to drag, you're able to drag a bit to the right, which shouldn't happen as it's a one column list. + + ![GitHub license](https://img.shields.io/badge/license-MIT-green.svg) [![npm](https://img.shields.io/npm/v/react-native-drag-sort.svg?style=flat)](https://npmjs.com/package/react-native-drag-sort) diff --git a/lib/AutoDragSortableView.js b/lib/AutoDragSortableView.js index 74d46d5..e55312b 100644 --- a/lib/AutoDragSortableView.js +++ b/lib/AutoDragSortableView.js @@ -315,7 +315,7 @@ export default class AutoDragSortableView extends Component{ } } - const left = this.touchCurItem.originLeft + dx; + const left = this.touchCurItem.originLeft; // + dx const top = this.touchCurItem.originTop + dy; this.touchCurItem.ref.setNativeProps({ diff --git a/lib/DragSortableView.js b/lib/DragSortableView.js index 6170f82..bf979d5 100644 --- a/lib/DragSortableView.js +++ b/lib/DragSortableView.js @@ -174,7 +174,7 @@ export default class DragSortableView extends Component{ } } - let left = this.touchCurItem.originLeft + dx + let left = this.touchCurItem.originLeft // + dx let top = this.touchCurItem.originTop + dy this.touchCurItem.ref.setNativeProps({