Skip to content

Commit

Permalink
Explicitly require react-addons-shallow-compare (ReactNative.addons i…
Browse files Browse the repository at this point in the history
…s deprecated in RN 0.25)

See facebook/react-native@0b534d1
  • Loading branch information
jeanregisser committed Apr 27, 2016
1 parent 562f788 commit fead058
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"url": "[email protected]:jeanregisser/react-native-slider.git"
},
"dependencies": {
"react-addons-shallow-compare": "^0.14.8",
"style-equal": "^1.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var {
PanResponder,
View
} = React;
var PureRenderMixin = React.addons.PureRenderMixin;
var shallowCompare = require('react-addons-shallow-compare');
var styleEqual = require('style-equal');

var TRACK_SIZE = 4;
Expand Down Expand Up @@ -173,7 +173,7 @@ var Slider = React.createClass({
// - when the event handlers change (rendering doesn't depend on them)
// - when the style props haven't actually change

return PureRenderMixin.shouldComponentUpdate.call(
return shallowCompare(
{ props: this._getPropsForComponentUpdate(this.props), state: this.state },
this._getPropsForComponentUpdate(nextProps),
nextState
Expand Down

0 comments on commit fead058

Please sign in to comment.