Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to React 0.14. #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-visibility-sensor",
"version": "2.1.0",
"version": "3.0.0",
"description": "Sensor component for React that notifies you when it goes in or out of the window viewport.",
"main": "visibility-sensor.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"author": "joshwnj",
"license": "MIT",
"peerDependencies": {
"react": ">=0.12.0 <0.14.0"
"react": ">=0.14.0"
},
"devDependencies": {
"browserify": "^5.11.2",
Expand All @@ -28,8 +28,9 @@
"karma-mocha": "^0.1.9",
"karma-phantomjs-launcher": "^0.1.4",
"mocha": "^1.21.4",
"react-addons": "^0.9.0",
"react-tools": "^0.11.1"
"react-dom": "^0.14.0",
"react-tools": "^0.11.1",
"reactify": "^0.14.0"
},
"browserify": {
"transform": [
Expand All @@ -41,8 +42,5 @@
"repository": {
"type": "git",
"url": "https://github.com/joshwnj/react-visibility-sensor.git"
},
"dependencies": {
"reactify": "^0.14.0"
}
}
15 changes: 8 additions & 7 deletions tests/visibility-sensor-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

require('es5-shim');

var React = require('react/addons');
var React = require('react');
var ReactDOM = require('react-dom');
var assert = require('assert');

describe('VisibilitySensor', function () {
Expand All @@ -14,7 +15,7 @@ describe('VisibilitySensor', function () {
});

afterEach(function () {
React.unmountComponentAtNode(node);
ReactDOM.unmountComponentAtNode(node);
document.body.removeChild(node);
});

Expand All @@ -40,7 +41,7 @@ describe('VisibilitySensor', function () {
<VisibilitySensor delay={10} onChange={onChange} />
);

React.render(element, node);
ReactDOM.render(element, node);
});

it('should notify of changes to visibility when child moves', function (done) {
Expand All @@ -56,7 +57,7 @@ describe('VisibilitySensor', function () {
width: 100,
left: -101
};
React.render(getElement(style), node);
ReactDOM.render(getElement(style), node);
}
// after moving the sensor it should be not visible anymore
else {
Expand All @@ -73,7 +74,7 @@ describe('VisibilitySensor', function () {
);
}

React.render(getElement(), node);
ReactDOM.render(getElement(), node);
});


Expand All @@ -86,7 +87,7 @@ describe('VisibilitySensor', function () {
<VisibilitySensor delay={1} onChange={onChange} />
);

React.render(element, node);
ReactDOM.render(element, node);
});

it('should not notify when deactivated', function (done) {
Expand All @@ -104,6 +105,6 @@ describe('VisibilitySensor', function () {
<VisibilitySensor active={false} delay={1} onChange={onChange} />
);

React.render(element, node);
ReactDOM.render(element, node);
});
});
3 changes: 2 additions & 1 deletion visibility-sensor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var React = require('react');
var ReactDOM = require('react-dom');

var containmentPropType = React.PropTypes.any;

Expand Down Expand Up @@ -70,7 +71,7 @@ module.exports = React.createClass({
* Check if the element is within the visible viewport
*/
check: function () {
var el = this.getDOMNode();
var el = ReactDOM.findDOMNode(this);
var rect = el.getBoundingClientRect();
var containmentRect;

Expand Down