Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-circle-checkbox

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-circle-checkbox - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

60

index.js

@@ -1,7 +0,7 @@

/*
ReactNativeCircleCheckbox 0.1.0
/*
ReactNativeCircleCheckbox 0.1.1
https://github.com/ParamoshkinAndrew/ReactNativeCircleCheckbox
(c) 2016 Andrew Paramoshkin <paramoshkin.andrew@gmail.com>
ReactNativeCircleCheckbox may be freely distributed under the MIT license.
*/
*/

@@ -20,7 +20,26 @@ 'use strict'

static propTypes = {
checked: React.PropTypes.bool,
outerSize: React.PropTypes.number,
filterSize: React.PropTypes.number,
innerSize: React.PropTypes.number,
outerColor: React.PropTypes.string,
filterColor: React.PropTypes.string,
innerColor: React.PropTypes.string,
onToggle: React.PropTypes.func.isRequired
};
static defaultProps = {
checked: false,
outerSize: 26,
filterSize: 23,
innerSize: 18,
outerColor: '#FC9527',
filterColor: '#FFF',
innerColor: '#FC9527'
};
constructor(props) {
super(props);
var outerSize = (props.outerSize) ? props.outerSize : 26;
outerSize = (parseInt(outerSize) < 10 || isNaN(parseInt(outerSize))) ? 10 : parseInt(outerSize);
var outerColor = (props.outerColor) ? props.outerColor : '#FC9527';
var outerSize = (parseInt(props.outerSize) < 10 || isNaN(parseInt(props.outerSize))) ? 10 : parseInt(props.outerSize);
var outerStyle = {

@@ -30,6 +49,5 @@ width: outerSize,

borderRadius: outerSize/2,
backgroundColor: outerColor
backgroundColor: props.outerColor
};
var filterSize = (parseInt(props.filterSize) > outerStyle.width + 3 || isNaN(parseInt(props.filterSize))) ? outerStyle.width - 3 : parseInt(props.filterSize);
var filterColor = (props.filterColor) ? props.filterColor : '#FFF';
var filterStyle = {

@@ -39,6 +57,5 @@ width: filterSize,

borderRadius: filterSize/2,
backgroundColor: filterColor
backgroundColor: props.filterColor
};
var innerSize = (parseInt(props.innerSize) > filterStyle.width + 5 || isNaN(parseInt(props.innerSize))) ? filterStyle.width - 5 : parseInt(props.innerSize);
var innerColor = (props.innerColor) ? props.innerColor : '#FC9527';
var innerStyle = {

@@ -48,8 +65,8 @@ width: innerSize,

borderRadius: innerSize/2,
backgroundColor: innerColor
backgroundColor: props.innerColor
};
this.state = {
checked: props.checked ? props.checked : false,
onPress: props.onPress,
checked: props.checked,
onToggle: props.onToggle,
_circleOuterStyle: outerStyle,

@@ -63,8 +80,3 @@ _circleFilterStyle: filterStyle,

return (
<TouchableHighlight style={[styles.alignStyle, this.state._circleOuterStyle]}
onPress={ () =>
(this.state.onPress) ?
this.state.onPress(this.state.checked) :
this._onPress(this.state.checked) }
>
<TouchableHighlight style={[styles.alignStyle, this.state._circleOuterStyle]} onPress={() => this._onToggle()}>
<View style={[styles.alignStyle, this.state._circleFilterStyle]}>

@@ -77,10 +89,10 @@ {this._renderInner()}

_onPress(checked) {
this.setState({
checked: !checked
});
_onToggle() {
if(this.props.onToggle) {
this.props.onToggle(!this.props.checked);
}
}
_renderInner() {
return this.state.checked ? (<View style={this.state._circleInnerStyle} />) : (<View/>);
return this.props.checked ? (<View style={this.state._circleInnerStyle} />) : (<View/>);
}

@@ -87,0 +99,0 @@ }

2

package.json
{
"name": "react-native-circle-checkbox",
"version": "0.1.0",
"version": "0.1.1",
"description": "Circle checkbox component for React Native",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,3 +15,3 @@ ReactNativeCircleCheckbox

checked={true}
onPress={(checked) => console.log('My state is: ', checked)}
onToggle={(checked) => console.log('My state is: ', checked)}
/>

@@ -18,0 +18,0 @@ ```

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