From c326bb51ea2e9abe838ef98a3a3f23a7900781cc Mon Sep 17 00:00:00 2001 From: Daniel Dimitrov Date: Mon, 21 Nov 2016 07:16:16 +0100 Subject: [PATCH] Active styles + different header when expanded Cherry picking from 8a801c7c1cbab3d15f6d683bdbabed7bf3b8de7e and b6dc7455277218c517dc175697955fc8a877655a https://github.com/naoufal/react-native-accordion/pull/38 --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index f5eeb14..edc5576 100644 --- a/src/index.js +++ b/src/index.js @@ -20,9 +20,11 @@ var Accordion = React.createClass({ easing: React.PropTypes.string, expanded: React.PropTypes.bool, header: React.PropTypes.element.isRequired, + headerOpen: React.PropTypes.element, onPress: React.PropTypes.func, underlayColor: React.PropTypes.string, - style: React.PropTypes.object + style: React.PropTypes.object, + styleOpen: React.PropTypes.object, }, getDefaultProps() { @@ -109,9 +111,9 @@ var Accordion = React.createClass({ ref="AccordionHeader" onPress={this._onPress} underlayColor={this.props.underlayColor} - style={this.props.style} + style={this.state.is_visible ? this.props.styleOpen : this.props.style} > - {this.props.header} + {this.state.is_visible && this.props.headerOpen ? this.props.headerOpen : this.props.header}