From 17d15e809886fae6b3a2be2aee8f754a5ddf0380 Mon Sep 17 00:00:00 2001 From: ponchautf Date: Mon, 19 Oct 2020 15:57:32 +0200 Subject: [PATCH 1/5] Update RadioButtonRN.js Add disabled prop --- RadioButtonRN.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RadioButtonRN.js b/RadioButtonRN.js index 4756e29..77a761e 100644 --- a/RadioButtonRN.js +++ b/RadioButtonRN.js @@ -116,7 +116,7 @@ class RadioButtonRN extends React.Component { render() { let { activeIndex, fadeAnim, animations } = this.state; - let { boxStyle, style, circleSize, textStyle, data, icon, activeColor, deactiveColor, boxActiveBgColor, boxDeactiveBgColor, box, textColor } = this.props; + let { boxStyle, style, circleSize, textStyle, data, icon, activeColor, deactiveColor, boxActiveBgColor, boxDeactiveBgColor, box, textColor, disabled } = this.props; return ( @@ -133,6 +133,7 @@ class RadioButtonRN extends React.Component { , boxStyle]} activeOpacity={0.9} onPress={() => this._changeRadio(item, index)} + disabled={disabled} > Date: Mon, 19 Oct 2020 16:11:56 +0200 Subject: [PATCH 2/5] Update RadioButtonRN.js update color on deactivate --- RadioButtonRN.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RadioButtonRN.js b/RadioButtonRN.js index 77a761e..4e8c6f7 100644 --- a/RadioButtonRN.js +++ b/RadioButtonRN.js @@ -137,12 +137,12 @@ class RadioButtonRN extends React.Component { > From da387e705ce01eafa68b2d62588e3effd1fd7783 Mon Sep 17 00:00:00 2001 From: ponchautf Date: Tue, 20 Oct 2020 15:43:08 +0200 Subject: [PATCH 3/5] Adding reset feature. This feature allow to reset the current choice (no radio will be selected). to enable this, add a ref to the component and call reference.current.reset(); --- RadioButtonRN.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RadioButtonRN.js b/RadioButtonRN.js index 4e8c6f7..0c181c7 100644 --- a/RadioButtonRN.js +++ b/RadioButtonRN.js @@ -75,6 +75,10 @@ class RadioButtonRN extends React.Component { this._checkAnimatons(); } } + + reset(){ + this.setState({activeIndex: -1}); + } _checkAnimatons() { const { animationTypes } = this.props; From a738b2154a6d20c4ad8cf0e8d940fbcd165cddbe Mon Sep 17 00:00:00 2001 From: ponchautf Date: Thu, 22 Oct 2020 15:45:29 +0200 Subject: [PATCH 4/5] Update RadioButtonRN.js Adding setactive feature --- RadioButtonRN.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RadioButtonRN.js b/RadioButtonRN.js index 0c181c7..3bdac33 100644 --- a/RadioButtonRN.js +++ b/RadioButtonRN.js @@ -79,6 +79,10 @@ class RadioButtonRN extends React.Component { reset(){ this.setState({activeIndex: -1}); } + + setActive(item, activeIndex){ + _changeRadio(item, activeIndex); + } _checkAnimatons() { const { animationTypes } = this.props; From f73718467e659d498af5cea156c926c821768d2d Mon Sep 17 00:00:00 2001 From: ponchautf Date: Thu, 22 Oct 2020 15:47:31 +0200 Subject: [PATCH 5/5] Update RadioButtonRN.js fix wrong copy paste on setactive --- RadioButtonRN.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RadioButtonRN.js b/RadioButtonRN.js index 3bdac33..386e29e 100644 --- a/RadioButtonRN.js +++ b/RadioButtonRN.js @@ -81,7 +81,7 @@ class RadioButtonRN extends React.Component { } setActive(item, activeIndex){ - _changeRadio(item, activeIndex); + this._changeRadio(item, activeIndex); } _checkAnimatons() {