Skip to content

Commit

Permalink
Created 'matchmediaquery' as a replacement for 'matchmedia'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncochard committed Jul 13, 2017
1 parent 6df7684 commit 1e8dcb9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions dist/react-responsive.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-responsive.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"dependencies": {
"hyphenate-style-name": "^1.0.0",
"matchmedia": "git+https://github.com/iceddev/matchmedia.git",
"matchmediaquery": "^0.2.0",
"prop-types": "^15.5.7"
},
"peerDependencies": {
Expand Down Expand Up @@ -71,7 +71,7 @@
"build:watch": "npm run build -- --watch",
"clean": "rimraf dist",
"lint": "eslint src",
"test": "NODE_PATH=$NODE_PATH:$PWD/src mocha -R spec --compilers js:babel-register --require ./test/setup.js test/*_test.js",
"test": "cross-env NODE_PATH=$NODE_PATH:$PWD/src mocha -R spec --compilers js:babel-register --require ./test/setup.js test/*_test.js",
"changelog": "github-changes -o contra -r react-responsive -b master -f ./CHANGELOG.md --order-semver --use-commit-body",
"docs": "npm run docs:pre && npm run docs:build && npm run docs:publish",
"docs:pre": "gitbook install && rimraf _book",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import matchMedia from 'matchmedia'
import matchMedia from 'matchmediaquery'
import hyphenate from 'hyphenate-style-name'
import mediaQuery from './mediaQuery'
import toQuery from './toQuery'
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class MediaQuery extends React.Component {
this.props.onBeforeChange(this.state.matches)
}
}

componentDidUpdate(_, prevState) {
if(this.props.onChange && prevState.matches !== this.state.matches) {
this.props.onChange(this.state.matches)
Expand Down
2 changes: 1 addition & 1 deletion test/index_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var React = require('react');
var MediaQuery = require('index');
var mm = { default: require('matchmedia') };
var mm = { default: require('matchmediaquery') };
var assert = require('chai').assert;
var sinon = require('sinon');
var TestUtils = require('react-addons-test-utils');
Expand Down
2 changes: 1 addition & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var jsdom = require('jsdom').jsdom;
var matchMedia = require('matchmedia');
var matchMedia = require('matchmediaquery');

process.env.NODE_ENV = 'test';

Expand Down

0 comments on commit 1e8dcb9

Please sign in to comment.