Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-draggable

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-draggable - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

2

bower.json
{
"name": "react-draggable",
"version": "0.8.0",
"version": "0.8.1",
"homepage": "https://github.com/mzabriskie/react-draggable",

@@ -5,0 +5,0 @@ "authors": [

@@ -96,1 +96,5 @@ # Changelog

IE8 is still not supported, as it is not supported by React.
### 0.8.1 (June 3, 2015)
- Add `resetState()` instance method for use by parents. See README ("State Problems?").

@@ -616,2 +616,11 @@ 'use strict';

// Intended for use by a parent component. Resets internal state on this component. Useful for
// <Resizable> and other components in case this element is manually resized and start/moveOnStartChange
// don't work for you.
resetState: function() {
this.setState({
offsetX: 0, offsetY: 0, clientX: 0, clientY: 0
});
},
render: function () {

@@ -618,0 +627,0 @@ // Create style object. We extend from existing styles so we don't

{
"name": "react-draggable",
"version": "0.8.0",
"version": "0.8.1",
"description": "React draggable component",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -51,3 +51,3 @@ # react-draggable [![Build Status](https://travis-ci.org/mzabriskie/react-draggable.svg?branch=master)](https://travis-ci.org/mzabriskie/react-draggable)

**`grid`**: specifies the x and y that dragging should snap to.
**`bounds`**: specifies movement boundaries. Accepted values:

@@ -117,4 +117,19 @@ - `parent` restricts movement within the node's offsetParent (nearest node with position relative or absolute), or

## State Problems?
`<Draggable>` is a stateful component. This means that it is storing its current drag offsets in its internal state.
This can cause problems with certain integrations. For example, if you change the position of the element manually,
`<Draggable>` can get into trouble as it assumes a translation in the DOM. If you see an element jump around the page
when you click it, this is affecting you.
This is an unfortunate side-effect of dragging, which is inherently stateful.
If you move the element manually, you have two options:
1. Feed the `<Draggable>` an `x` and `y` parameter in the `start` param, and change it as you go while setting
`moveOnStartChange` to `true`, or,
2. When moving the `<Draggable>`, ref the element and
[call `resetState()`](https://github.com/STRML/react-resizable/blob/master/lib/Resizable.jsx#L48).
## Contributing

@@ -121,0 +136,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc