Socket
Socket
Sign inDemoInstall

nuke-switch

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-switch - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/styles.js

3

docs/basic.md

@@ -81,4 +81,3 @@ # Switch Demo

<View style={styles.cellItem}>
<Switch disabled size="small" checked={true}/>
<Switch disabled size="small" checked={false}/>
</View>

@@ -85,0 +84,0 @@ </View>

# Changelog
## 1.0.1 / 2017-11-08
* [[a0dec65](http://gitlab.alibaba-inc.com/nuke/switch/commit/a0dec65d106de42ae2ab49a9516ae623ddf5699a)] - `feat` add android h5 style && h5 setup feature
## 1.0.0 / 2017-11-04

@@ -5,0 +9,0 @@

/* @jsx createElement */
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -15,5 +14,5 @@

var _raxSwitch = require('rax-switch');
var _switch = require('./switch');
var _raxSwitch2 = _interopRequireDefault(_raxSwitch);
var _switch2 = _interopRequireDefault(_switch);

@@ -31,74 +30,77 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Switch = function (_Component) {
_inherits(Switch, _Component);
_inherits(Switch, _Component);
function Switch(props) {
_classCallCheck(this, Switch);
function Switch(props) {
_classCallCheck(this, Switch);
var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this, props));
var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this, props));
_initialiseProps.call(_this);
_initialiseProps.call(_this);
var checked = false;
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}
var checked = false;
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}
_this.state = {
checked: checked
};
return _this;
_this.state = {
checked: checked
};
return _this;
}
_createClass(Switch, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if ('checked' in nextProps) {
this.setState({ checked: nextProps.checked });
}
}
}, {
key: 'render',
value: function render() {
var checked = this.state.checked;
_createClass(Switch, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if ('checked' in nextProps) {
this.setState({ checked: nextProps.checked });
}
}
}, {
key: 'render',
value: function render() {
var checked = this.state.checked;
return (0, _rax.createElement)(_switch2.default, _extends({}, this.props, {
onValueChange: this.handleClick,
value: checked
}));
}
}]);
return (0, _rax.createElement)(_raxSwitch2.default, _extends({}, this.props, { onValueChange: this.handleClick, value: checked }));
}
}]);
return Switch;
return Switch;
}(_rax.Component);
Switch.defaultProps = {
onValueChange: noop,
size: 'medium',
defaultChecked: false,
defaultIndeterminate: false,
onTintColor: '#00e158',
thumbTintColor: '#fff',
tintColor: '#ffffff'
onValueChange: noop,
size: 'medium',
defaultChecked: false,
defaultIndeterminate: false,
onTintColor: '#00e158',
thumbTintColor: '#fff',
tintColor: '#ffffff'
};
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
var _this2 = this;
this.handleClick = function (e) {
var _props = _this2.props,
_props$disabled = _props.disabled,
disabled = _props$disabled === undefined ? false : _props$disabled,
_props$onValueChange = _props.onValueChange,
onValueChange = _props$onValueChange === undefined ? function () {} : _props$onValueChange;
this.handleClick = function (e) {
var _props = _this2.props,
_props$disabled = _props.disabled,
disabled = _props$disabled === undefined ? false : _props$disabled,
_props$onValueChange = _props.onValueChange,
onValueChange = _props$onValueChange === undefined ? function () {} : _props$onValueChange;
if (disabled) {
return null;
}
var checked = !_this2.state.checked;
if (!('checked' in _this2.props)) {
_this2.setState({
checked: checked
});
}
onValueChange(checked, e);
};
if (disabled) {
return null;
}
var checked = !_this2.state.checked;
if (!('checked' in _this2.props)) {
_this2.setState({
checked: checked
});
}
onValueChange(checked, e);
};
};

@@ -105,0 +107,0 @@

{
"name": "nuke-switch",
"version": "1.0.0",
"version": "1.0.1",
"description": "开关",

@@ -47,4 +47,5 @@ "main": "lib/index",

"dependencies": {
"rax-switch": "^0.3.7",
"nuke-env": "^1.x.x"
"nuke-core": "^1.0.x",
"nuke-env": "^1.x.x",
"nuke-theme-provider": "^1.0.x"
},

@@ -51,0 +52,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc