Skip to content

Commit

Permalink
Merge pull request #3353 from GeekyAnts/revert-3352-revert-3240-feat/…
Browse files Browse the repository at this point in the history
…accordianDisableRow

Revert "Revert "Feat/accordian disable row""
  • Loading branch information
shivrajkumar authored Jan 7, 2021
2 parents d3d3d65 + 2de1a1b commit ee12a25
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
18 changes: 14 additions & 4 deletions src/basic/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const styles = StyleSheet.create({
class DefaultHeader extends React.Component {
render() {
const {
disable,
expanded,
expandedIcon,
expandedIconStyle,
Expand All @@ -41,7 +42,10 @@ class DefaultHeader extends React.Component {
headerStyle || { backgroundColor: variables.headerStyle }
]}
>
<Text> {title}</Text>
<Text style={{ color: disable ? variable.disableRow : null }}>
{' '}
{title}
</Text>
<Icon
style={[
{ fontSize: variables.accordionIconFontSize },
Expand All @@ -51,7 +55,8 @@ class DefaultHeader extends React.Component {
: { color: variables.expandedIconStyle }
: icon && iconStyle
? iconStyle
: { color: variables.iconStyle }
: { color: disable ? variable.disableRow : variables.iconStyle },

]}
name={
expanded ? expandedIcon || 'ios-arrow-up' : icon || 'ios-arrow-down'
Expand Down Expand Up @@ -107,6 +112,7 @@ class AccordionItem extends React.Component {
render() {
const {
contentStyle,
disable,
expanded,
expandedIcon,
expandedIconStyle,
Expand All @@ -124,6 +130,7 @@ class AccordionItem extends React.Component {
return (
<View>
<TouchableWithoutFeedback
disabled={disable}
onPress={() => {
onAccordionOpen && !expanded && onAccordionOpen(item, index);
onAccordionClose && expanded && onAccordionClose(item, index);
Expand All @@ -135,7 +142,7 @@ class AccordionItem extends React.Component {
renderHeader(item, expanded, index)
) : (
<DefaultHeader
title={item.title}
disable={disable}
expanded={expanded}
headerStyle={headerStyle}
icon={icon}
Expand Down Expand Up @@ -174,7 +181,7 @@ export class Accordion extends React.Component {
selected = expandMultiple ? selected : selected.slice(0, 1);
}
this.state = {
selected
selected: props.expanded,
};
}

Expand All @@ -194,6 +201,7 @@ export class Accordion extends React.Component {
const {
contentStyle,
dataArray,
disable,
expandedIcon,
expandedIconStyle,
headerStyle,
Expand Down Expand Up @@ -222,6 +230,7 @@ export class Accordion extends React.Component {
keyExtractor={(item, index) => String(index)}
renderItem={({ item, index }) => (
<AccordionItem
disable={disable == index ? true : false}
key={String(index)}
item={item}
expanded={this.state.selected.indexOf(index) !== -1}
Expand All @@ -237,6 +246,7 @@ export class Accordion extends React.Component {
expandedIconStyle={expandedIconStyle}
onAccordionOpen={onAccordionOpen}
onAccordionClose={onAccordionClose}
setSelected={(i) => this.setSelected(i)}
/>
)}
{...this.props}
Expand Down
1 change: 1 addition & 0 deletions src/theme/variables/commonColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {
contentStyle: '#f5f4f5',
expandedIconStyle: '#000',
accordionBorderColor: '#d3d3d3',
disableRow: '#a9a9a9',

// ActionSheet
elevation: 4,
Expand Down
17 changes: 7 additions & 10 deletions src/theme/variables/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
contentStyle: '#f5f4f5',
expandedIconStyle: '#000',
accordionBorderColor: '#d3d3d3',
disableRow: '#a9a9a9',

// ActionSheet
elevation: 4,
Expand Down Expand Up @@ -180,14 +181,10 @@ export default {
toolbarDefaultBorder: '#3F51B5',
iosStatusbar: 'light-content',
get statusBarColor() {
return color(this.toolbarDefaultBg)
.darken(0.2)
.hex();
return color(this.toolbarDefaultBg).darken(0.2).hex();
},
get darkenHeader() {
return color(this.tabBgColor)
.darken(0.03)
.hex();
return color(this.tabBgColor).darken(0.03).hex();
},

// Icon
Expand Down Expand Up @@ -292,13 +289,13 @@ export default {
topInset: 24,
leftInset: 0,
rightInset: 0,
bottomInset: 34
bottomInset: 34,
},
landscape: {
topInset: 0,
leftInset: 44,
rightInset: 44,
bottomInset: 21
}
}
bottomInset: 21,
},
},
};
1 change: 1 addition & 0 deletions src/theme/variables/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
expandedIconStyle: '#000',
headerStyle: '#edebed',
iconStyle: '#000',
disableRow: '#a9a9a9',

// ActionSheet
elevation: 4,
Expand Down

0 comments on commit ee12a25

Please sign in to comment.