Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set style for active/expanded? #9

Open
andreaslindahl opened this issue Oct 7, 2015 · 8 comments
Open

Set style for active/expanded? #9

andreaslindahl opened this issue Oct 7, 2015 · 8 comments

Comments

@andreaslindahl
Copy link

Is is possible to set different styles on the header, depending on whether the accordion is expanded or not?

Also, it is possible to only allow one accordion to be expanded at a time?

@abritez
Copy link

abritez commented Jul 23, 2016

Would love to know how to do this as well

@tsyirvo
Copy link

tsyirvo commented Jul 24, 2016

It would really help me as well if we could have a props returning if the accordion is opened or closed.

@tsyirvo
Copy link

tsyirvo commented Jul 24, 2016

I'll submit a PR shortly to have a prop for the opened and closed header ;)

@digitaldavenyc
Copy link

@tsyirvo Did you ever get around to submitting a PR for this? Could use this feature as well.

@digitaldavenyc
Copy link

digitaldavenyc commented Aug 31, 2016

Could there be a way to access the is_visible variable to determine being opened or closed?

@tsyirvo
Copy link

tsyirvo commented Sep 5, 2016

@digitaldavenyc I didn't submit my PR yet :/
In the meantime, you can change {this.props.header} on line 106 by this.state.is_visible ? this.props.headerOpened : this.props.headerClosed.
It will allow you to have two props for the header, one when closed and one when open ;)

@digitaldavenyc
Copy link

@tsyirvo I'm not sure what you mean by that method? Can u elaborate on the implementation.

btw. sorry for super delayed response

@ercpereda
Copy link

Change line 106 to {this.props.header({ isOpen: this.state.is_visible })}

and then you can use your component like

<Accordion
  header={({isOpen}) => <View><Text>{isOpen}</Text></View>}
  content={<View><Text>Hello World!</Text></View>}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants