nuke-touchable
Advanced tools
Comparing version 2.0.2 to 2.0.3
# Changelog | ||
## 2.0.3 / 2018-05-10 | ||
* [[d702863](http://gitlab.alibaba-inc.com/nuke/touchable/commit/d7028639b800aa42a8bc99475e8a1bdc20f1c5d0)] - `fix` fix set style bug | ||
## 2.0.2 / 2018-05-10 | ||
@@ -5,0 +9,0 @@ |
@@ -54,3 +54,5 @@ /* @jsx createElement */ | ||
_this.dom = null; | ||
_this.originalStyle = null; | ||
_this.activeStyle = null; | ||
_this.rippleEnabled = isAndroid && (props.rippleEnabled || context.androidConfigs && context.androidConfigs.rippleEnabled); | ||
@@ -83,6 +85,9 @@ | ||
value: function setStyle(styleData) { | ||
var elementStyle = this.findDom().style; | ||
for (var styleName in styleData) { | ||
elementStyle[styleName] = styleData[styleName]; | ||
} | ||
// const elementStyle = this.findDom().style; | ||
(0, _rax.setNativeProps)(this.refs.touch, { | ||
style: styleData | ||
}); | ||
// for (const styleName in styleData) { | ||
// elementStyle[styleName] = styleData[styleName]; | ||
// } | ||
} | ||
@@ -94,5 +99,12 @@ }, { | ||
activeStyle = _props.activeStyle, | ||
style = _props.style, | ||
onTouchStart = _props.onTouchStart; | ||
this.setStyle(activeStyle); | ||
if (!this.originalStyle) { | ||
this.originalStyle = _extends({}, style); | ||
} | ||
if (!this.activeStyle) { | ||
this.activeStyle = _extends({}, activeStyle); | ||
} | ||
this.setStyle(Object.assign({}, style, activeStyle)); | ||
onTouchStart && onTouchStart(e); | ||
@@ -107,3 +119,3 @@ } | ||
this.setStyle(style); | ||
this.setStyle(this.originalStyle || style); | ||
onTouchEnd && onTouchEnd(e); | ||
@@ -110,0 +122,0 @@ } |
{ | ||
"name": "nuke-touchable", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "可点击容器", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -5,3 +5,9 @@ /* @jsx createElement */ | ||
import { createElement, findDOMNode, PropTypes, Component } from 'rax'; | ||
import { | ||
createElement, | ||
findDOMNode, | ||
setNativeProps, | ||
PropTypes, | ||
Component, | ||
} from 'rax'; | ||
import { isWeex, appInfo } from 'nuke-env'; | ||
@@ -21,3 +27,5 @@ import View from 'nuke-view'; | ||
super(props); | ||
this.dom = null; | ||
this.originalStyle = null; | ||
this.activeStyle = null; | ||
this.rippleEnabled = | ||
@@ -45,10 +53,19 @@ isAndroid && | ||
setStyle(styleData) { | ||
const elementStyle = this.findDom().style; | ||
for (const styleName in styleData) { | ||
elementStyle[styleName] = styleData[styleName]; | ||
} | ||
// const elementStyle = this.findDom().style; | ||
setNativeProps(this.refs.touch, { | ||
style: styleData, | ||
}); | ||
// for (const styleName in styleData) { | ||
// elementStyle[styleName] = styleData[styleName]; | ||
// } | ||
} | ||
touchStart(e) { | ||
const { activeStyle, onTouchStart } = this.props; | ||
this.setStyle(activeStyle); | ||
const { activeStyle, style, onTouchStart } = this.props; | ||
if (!this.originalStyle) { | ||
this.originalStyle = { ...style }; | ||
} | ||
if (!this.activeStyle) { | ||
this.activeStyle = { ...activeStyle }; | ||
} | ||
this.setStyle(Object.assign({}, style, activeStyle)); | ||
onTouchStart && onTouchStart(e); | ||
@@ -58,3 +75,3 @@ } | ||
const { style, onTouchEnd } = this.props; | ||
this.setStyle(style); | ||
this.setStyle(this.originalStyle || style); | ||
onTouchEnd && onTouchEnd(e); | ||
@@ -61,0 +78,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
31479
702
0