Skip to content

Commit

Permalink
use style property when assigning styles with setNativeProps in pan r…
Browse files Browse the repository at this point in the history
…esponder example
  • Loading branch information
atticoos committed Oct 9, 2015
1 parent 05c08a4 commit a57bace
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Examples/UIExplorer/PanResponderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ var PanResponderExample = React.createClass({
this._previousLeft = 20;
this._previousTop = 84;
this._circleStyles = {
left: this._previousLeft,
top: this._previousTop,
style: {
left: this._previousLeft,
top: this._previousTop,
}
};
},

Expand All @@ -78,13 +80,17 @@ var PanResponderExample = React.createClass({

_highlight: function() {
this.circle && this.circle.setNativeProps({
backgroundColor: processColor(CIRCLE_HIGHLIGHT_COLOR)
style: {
backgroundColor: processColor(CIRCLE_HIGHLIGHT_COLOR)
}
});
},

_unHighlight: function() {
this.circle && this.circle.setNativeProps({
backgroundColor: processColor(CIRCLE_COLOR)
style:{
backgroundColor: processColor(CIRCLE_COLOR)
}
});
},

Expand All @@ -106,8 +112,8 @@ var PanResponderExample = React.createClass({
this._highlight();
},
_handlePanResponderMove: function(e: Object, gestureState: Object) {
this._circleStyles.left = this._previousLeft + gestureState.dx;
this._circleStyles.top = this._previousTop + gestureState.dy;
this._circleStyles.style.left = this._previousLeft + gestureState.dx;
this._circleStyles.style.top = this._previousTop + gestureState.dy;
this._updatePosition();
},
_handlePanResponderEnd: function(e: Object, gestureState: Object) {
Expand Down

0 comments on commit a57bace

Please sign in to comment.