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

Tab component reverts to first tab whenever parent component renders #26

Open
matthewgertner opened this issue Apr 28, 2015 · 9 comments

Comments

@matthewgertner
Copy link
Contributor

I'm embedding your component in another React component. Every time I emit a change event in one of the tabs, the tab component displays the first tab. The problem seems to be the componentWillReceiveProps method. It always sets the state to the "new" tabActive property even if it is the same as the old tabActive property. As a result, if you don't pass in the prop explicitly, it reverts to the default value on every render. Wouldn't it be better to have the following?

  componentWillReceiveProps: function(newProps){
    if(newProps.tabActive && newProps.tabActive !== this.props.tabActive){
      this.setState({tabActive: newProps.tabActive})
    }
  }

Or am I misunderstanding something?

@ustccjw
Copy link

ustccjw commented May 20, 2015

+1

1 similar comment
@theogravity
Copy link

+1

@theogravity
Copy link

@matthewgertner Given that the author has been unresponsive for months, may I ask you to publish your PR as a node module (eg react-simpletabbed)?

@maccman
Copy link

maccman commented Jul 29, 2015

+1

@matthewgertner
Copy link
Contributor Author

@pedronauck Making a last effort to get your attention. Any chance you can accept the PR and publish a new NPM package?

@dmatteo
Copy link

dmatteo commented Jul 30, 2015

@matthewgertner fork his version on your repo, tag it and use the tar package in your package.json

Got confused with who was unresponsive :D

@theogravity
Copy link

@matthewgertner I think it's safe to fork and publish a new one.

@matthewgertner
Copy link
Contributor Author

Okay I'll get it done this week.

@theogravity
Copy link

👍

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

No branches or pull requests

5 participants